I have done alot of testing on the Feature memory and for anyone who is having problems with dynamic memory space read on...
Feature memory is a feature that was added in OS 3.1
It allowed to allocate storage space and put the pointer in a specified feature slot. Each feature slot is identified by a feature ID which is 16bit (65,535 slots).
In PalmOS 3.5 you can allocate above 64KB. This is useful for allocating large amounts of data like off-screen windows on the new OS5 devices where the display is 320x320. This requires over 100KB which cannot be allocated on dynamic memory.
Reading speed is as fast as dynamic memory since it uses a direct pointer to the storage space. However you need to use DmWrite to write information to the space. This means that write speed is just as slow as writing to a record. However if the contents do not change much this is not a problem.
Feature memory lasts untill the device is reset. This means that if you need to store information that needs to be accessed quickly but in short bursts for example a launcher, then feature memory is the way to go since it does not take up dynamic memory and therefore you can use as much of the space that you want without interfering with other applications.
Each feature ID is asigned to a CreatorID. The CreatorID is a four letter char that describes the application such as 'tEXT'.
All this information is documented in the PalmOS Docs however I have discovered a way to allocate/destroy memory using pointers without having to store feature IDs.
Choose one feature ID that will be used for memory allocations. I generally use Feature ID 0. Then when you want to allocate new memory call FtrMemNew with the feature ID 0. Take the pointer and put it somewhere. Then call FtrUnregister and not FtrMemFree. Why? Because then it does not destroy the memory but frees the ID 0. That way next time you allocate just do the same thing and it will give you some more memory space.
To free a pointer call FtrSet and set the value of ID 0 to the pointer and then call FtrPtrFree. This will free the memory and unregister the ID 0 for a next allocation/destroy of data.
The only problem is that you must not loose a pointer or you will have memory being used for nothing.
If anyone you have any problems send me an email to
zhamilton1@yahoo.co.uk or post here where I'll check up here and then.
I hope this has been useful info to you... (: