I have a problem with heap fragmentation when using the Net Library. Opening and
closing the Net Library reduces my largest free chunk in the heap from 71K to
37K. 

The following code seems to allocate a nonmovable chunk with size 3200 bytes in
the middle of the heap and causing a heap fragmentation. I.e. NetLibClose() does
not clean up after the NetLibOpen() call. Does anyone know if I'm doing
something wrong or are there any workaround?

I'm using Palm V with Palm OS 3.5.  Here is a code snippet:

UInt32 free1, max1 free2, max2;
UInt16 refNum, ifErrs = 0;          

::MemHeapCompact(0);
::MemHeapFreeBytes(0, &free1, &max1);  // free1 = 79630, max1 = 71000

::SysLibFind("Net.lib", &refNum);
::NetLibOpen(refNum, &ifErrs );
::NetLibClose(refNum, true);

::MemHeapCompact(0);
::MemHeapFreeBytes(0, &free2, &max2);  // free2 = 76786, max2 = 37446

Any help is most appreciated.

Ulf Schroder

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to