Yep. But you have to use DmWrite() to write to it. You can read from it normally.

Also, I am not sur if MemPtrFree will work. It PROBABLY will, but since you've got the handle, it's faster to do MemHandleFree(h) anyway.


Alan Pinstein
Synergy Solutions, Inc.
http://www.synsolutions.com
1-800-210-5293


>Concerning using DmNewHandle, do I treat that handle just as if it were a
>handle from MemHandleNew? That is:
>
> VoidHand hTest = DmNewHandle(m_DescriptorDB, 1000);
> // Test for success here
> char ** pTest = (char **) MemHandleLock(hTest);
> // Test for success here
> // Use the chunk here
>
> MemPtrUnlock(pTest);
> MemPtrFree(pTest);
>
>Thanks,
>
>
>
>At 5/21/99 04:36 PM, you wrote:
>>At 4:01 PM -0700 5/21/99, Jason Dawes wrote:
>>>70 * 2000 = 140,000. Somehow I think that the Palm is going to have a
>>>little trouble allocating 136K of memory when it only has 96K total. You
>>>need to use a database.
>>
>>Or at least use storage heap space. You can call DmNewHandle to get a
>>chunk of memory in the storage heap that is not associated with any
>>database.
>>
>>If these strings really are temporary, that may be what you want. Of
>>course, you'll still be restricted to the per-chunk limit of a bit less
>>than 64K... and if you're smart, you'll make sure you can use smaller
>>chunks so your allocator can still work when memory is nearly full or very
>>fragmented.
>>
>>I'd suggest avoiding 1 record per string. Each record in a record database
>>uses around 20 bytes of pure overhead, so with 2000 records that's 40K just
>>for the management.
>>
>>DmNewHandle chunks require only 12 bytes of overhead each -- the same
>>amount as is required for a handle allocated from the dynamic heap. So
>>play with the strings-per-chunk value to tune it for space overhead vs time
>>overhead.
>>
>>On the other hand, if your strings aren't really temporary, you might be a
>>lot better off making them resources as part of a companion database for
>>your app...
>>
>> --Bob
>>
>>
>>
>
>
>- Alan Macy
> http://www.ResponsiveSoftware.com
> Time and Billing for Consultants and Others
>

Reply via email to