Logo
© 2007 Lukas Grundmann

mailto:supportMHH@lukas-grundmann.de1.cc

 

Warning!!!!!

 

You use More Heap Hack on your own risk! The write protection of your storage heap will be disabled. The result is that a poorly written application can destroy or corrupt your data. You should backup your data before and while using More Heap Hack. Devices with NVFS are unsupported since a Palm OS bug makes dynamic heap extension very dangerous on this devices.


Introduction

 

More Heap Hack tries to enlarge the dynamic heap of your Palm OS 5.0 device using the storage heap. Many emulators for Palm OS need a great amount of dynamic heap. But many devices (like Tungsten T, T2, E) haven´t much dynamic heap. In this cases More Heap Hack can help.

 

Requirements

 

- Palm OS 5.0 – 5.3 device with Arm CPU

- Enough free storage heap which should be defragmented as much as possible

(a soft reset can make it)

 

Installation

 

1.        Copy the MoreHeap.prc to your device

2.        Now do a soft reset. More Heap Hack should now be install itself in the system

 

What to do if More Heap Hack fails in a bad way?

 

The cleanest solution to remove More Heap Hack is to do a warm reset (on most device this is done by holding the page up key and pressing the reset button) then to delete the MoreHeapHack.prc with your preferred File Manager and then to do a normal soft reset.

 

The Control Panel

 

You control More Heap Hack over the GUI control panel. Simply start the More Heap Hack application from your launcher and you will get to the preferences. Changes on the preferences will be applied with quitting the control panel.

 

 

Select the check box “Activated” is activating More Heap Hack. When “Activated” AND “Activate after reset” are selected More Heap Hack will automatically be activated at soft reset.

 

In the list you see for which applications exceptions are configured.

 

Over the button “Add” you can add a new exception. With “Remove” you remove the selected exception and with “Modify” you can change it.











Choose “for a RAM application” if the application for which the exception should be is in the RAM. Other options here may come in the future.


Or choose “Cancel” if you want to go back to the main screen without done anything.














In this screen you can choose for which application a new exception should be created. The applications which already have an exception are not in this list. With pressing “Cancel” nothing will be choosed and you will return to the main page. Pressing “OK” will open the Exception Dialog with the selected application preconfigured.

 

 

 

 

 

 

 

 

 






The title of this dialog shows for which application the exception is. If “Disable MH for this app” is selected More Heap Hack will not acting in the specified application. If you see that a special application don´t work together with More Heap Hack but have already enough dynamic heap then this disable function is useful.

 

With selecting “Clean up for this app” the clean up function for the specified application is activated. Some application do not free their allocated chunks with the routine for that. Chunks which remains so in the real dynamic heap will be removed automatically by the Palm OS when the application will be quit. But for some reasons (which I don´t now) the OS doesn´t do this with chunks allocated in the storage heap and this means that these chunks will remain until the next reset. In this way memory is lost until the next reset. The cleanup functions will try to collect the not freed chunks and then they will be removed by More Heap Hack when the application quits.

 

With the field under the label “Amount of heap shown” you specify which information of the dynamic heap (heap size, free bytes, size of biggest avaible chunk) will be shown to the application. Empty field or the value 0 means that as dynamic heap size the size of the storage heap + the size of the real dynamic heap as free bytes the amount of free bytes of both chunks together and as max avaible chunk the biggest chunk of both heaps will be shown. A value greater than 0 can be used for debug purpose.

 

When “Force” is choosed the simulated dynamic heap will really get smaller with allocating a chunk even when were was much more free bytes as shown. This function only works with an value greater than 0 in the “Amount of heap shown” field and is only for debug purpose when you are a developer. (as an example: If you want to test how your application work with few free memory)


Type and creator shows the creator and type ID of the application for which the exception is.


With pressing the button “Ok” the exception will be saved and you will return to the main page.


Pressing “Cancel” will leading either to the application list or the main page without the configuration be saved.


Technical review or how More Heap Hack works

 

You have only to read this if you are interested about a short information how More Heap hack works.

 

Almost every Palm OS 5.X PDA has an build in RAM. This RAM is seperated into parts named heaps. There is an big part the storage heap in which the data is stored. On newer devices with an build in flash the storage heap is used as a database cache to make working faster and to save the flash (remember that writing often to a flash isn´t well for it) An even smaller heap is the dynamic heap. This heap is used on all devices as working memory where data used at runtime is stored by the applications. Memory allocating in both heaps is done over the same low level routine. Now it is possible to patch routines (undocumented and so dangerous) under Palm OS so that your code will be called instead of the standard routine placed in the ROM. I simply patch the memory allocating routine. My routine then tries to allocate memory chunks which are to big for the dynamic heap in the storage heap.

 

But now there is a next problem the storage area protection. To protect the data stored in the storage heap Palm OS 5.x uses the MMU to avoid direct writing to the storage heap. A special save routine should instead be used to write in the data stored in storage heap. But working memory have to be written directly for speed reason. To go around of this I use another undocumented and dangerous OS function to disable the storage write protection. A big disadvantage of this is certainly that now all the data is unprotected. The only way to come out of this problem I think is using the MMU directly. I´m still working on this. But for now More Heap Hack Users have to live with unprotected data. :(

 

To release the clean up and the other special functions (a.E. showing wrong dynamic heap informations) I also patch two heap information routines and the low level routine which deallocate memory. I´m using another patch to play in the exceptions when an application starts and cleanup is done when application quits. To prevent that a third party application accidentally enables the protection I also patch the routine over which this is done.

 

This was just a short description and if you are interested more have a look into the source code.


Why MHH on NVFS is too dangerous


Palm OS 5.4 have a dangerous bug which allows the OS in some situations to write into the compressed ROM image stored on the build in flash. There is almost no documentation about this OS bug avaible but though I found something. The dangerous situation seems to be if either the data area in the flash is very full or the dynamic heap and the DB cache are very full. Flushing the db cache then shall increase the danger. Well there are solutions to prevent that the single parts of memory got to much full. But I don´t know that this would be enough to go around this NVFS bug and since I have no need and power to research more in this section MHH will never run save on NVFS. Also there is a good but commercial alternative to MHH. Google after it. This alternative runs stable on NVFS in the last version.


Development

 

More Heap Hack was developed onboard on a Tungsten T2 and a Tungsten E with the help of following tools:

 

Tool

Purpose

Developer

Link

Piaf

source editor

Philippe Guillot & Laurent Duveau

http://www.ppcompiler.org/

NaPP (Native Palm Pascal) Compiler

with this pascal compiler the arm native code was generated

Philippe Guillot

http://www.ppcompiler.org/

PP (Palm Pascal) Compiler

with this 68k (and thumb code) version of the PP Compiler the 68k code was created

Philippe Guillot

http://www.ppcompiler.org/

Bird

resource (forms, alerts ...) editor

Philippe Guillot

http://www.ppcompiler.org/

TBMP Edit

To creating Bitmaps

Peter Moñko

http://tbmpedit.sourceforge.net/

Turmfalke

to create arm versions of 68k resources

I (Lukas Grundmann)

http://www.lukas-grundmann.de1.cc/TurmFalke1_1a.zip

 

http://www.ppcompiler.org/thread.php?lng=en&pg=4384&fid=1&cat=3

 

All this tools are great and free!

 

Supported devices

 

More Heap Hack should work on every Palm OS 5.0 – 5.3 device with ARM CPU.

 

Reported devices on which it runs:

·         Tungsten E

·         Tungsten T2

·         Zire 72

·         Tungsten C


 

Unsupported devices:


Please contact me if More Heap Hack works well (or not) for you two and your device isn't on that list.

 

Reported bugs

 

Bug

Fix or work around

GrxView crashes in the thumbnail view

Add a exception and set amount of heap shown to 1000

Reset loop on T2 and TE if a reset is done with MHH enabled while the automatic activating function is turned off

Should be fixed in the latest version.


If you find a bug please report it to me.

 

Change Log

 


Download



old stuff:



License


More Heap Hack was published under the terms of the GPL version 2.0. Have a look into the package for more information.


Contact

 

If you have a suggestion, a bug report or a question please feel free to contact me over email.