if you're new to the c language and don't know malloc or free then you
should find a good c programming book.  If you're just new to palm os, read
on...

MemPtrNew works like malloc
MemPtrFree works like free

The problem with MemPtrNew is that it leaves memory locked.  So if at a
later time you need to request a large allocation, and memory has become
fragmented because of many small allocations, you're out of luck.

MemHandleNew requests moveable memory allocation.  This means the OS can
move your block.  But you say, if it moves, how do I use it as a pointer?
Well you lock it.

MemHandleLock to get a pointer, and
MemHandleUnlock it to tell the OS you're done using it for now and it can be
move.  When you need it again you'll call MemHandleLock again.

I suggest reviewing the chapter on memory management in the book Palm
Programming : A developers guide.  Its by Niel Rhodes.  About $30 I think.
Its also on the web if I'm not mistaken. (at least some of it).

Steve

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Laor,
Boaz
Sent: Friday, March 16, 2001 7:04 AM
To: Palm Developer Forum
Subject: char ** double pointer question


you can allocate memeory to a pointer like this

Memhandle textH = MemHandleNew(128);
Char * text = MemHandleLock(textH);

lets say i have a structure like this...

Char ** abs;

how would i dynamically allocate memory for it?

boaz


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


-- 
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