Subject: Memory Management
From: [EMAIL PROTECTED]
Date: Tue, 22 Nov 2005 09:30:59 -0000

From last few days I am working on palm C++. Initially I used to be a C++ Programmer. I have few querries regarding to Memory Handling.

I have one Engine for C++ platforms. It just does some task for me. I am reusing that in my Palm Application. I wanted to use the classes( Engine ) those were already developed by me for other platforms. So I changed the extension my AppMain.c to AppMain.cpp. And started using my classes.

1. Whatever I am doing in my Engine is purely Object Oriented and I have handled memory according to C++. i.e. "new" and "delete". But As Palm documentation suggest that you should use memory using handles or ptrs. Is it the case that I must use MemHandle to deal with my memory? Means I dont want to change my C++ code that I have written for other platforms.

2. I am getting following error:
HeapHandlePool.c(1418): HeapMgr: 0x475430B8 - Chunk over-locked

There is already a lot of discussion on this topic. I am not using a Memory Handler functions in my application. i.e. I am not Locking the memory anywhere but only in Drawing bitmaps. And I am unlocking it. So what is the cause of this error?

Final Words: Can my application survive only on "new" and "delete" of C++, not "Lock" and "Unlock"?

You can use "new" and "delete", but the implementation doesn't throw an exception if "new" fails. Under the skin, "new" uses MemPtrNew.

So you have to make sure you don't use "new" if you don't have enough heap memory.

There is a fix for this, where you can provide your own implementation of "new" and "delete", but I can't remember where it is documented. Try the KB and the archives.


Roger Stringer
Marietta Systems, Inc. (www.rf-tp.com)


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

Reply via email to