Use Try-And-Catch mechanism (See PalmOS companion / Debugging strategies)
-----Original Message----- From: Steve Branin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 27 November 2001 7:35 AM To: Palm Developer Forum Subject: Proper way to create and instance of a C++ object in Palm OS Hi all, I have searched the archives extensively and I can't find any posts that relate to my problem so I'll ask it here and hope that this isn't a frequent topic here. Here goes. Typically in C++ when I want to create an instance of an object I do something like this: MyClass* pMyObject = NULL; pMyObject = new MyClass(); if (pMyObject) { do something } and this is sufficient to verify that enough heap space was available to successfully create the object. However, when I do this in PalmOS and there is not enough memory my application exits on the "new" line and never makes it to the check. What should I be doing to protect myself from an out of memory condition? I found tons of articles about memory management but none that answered my question. Code snippets would be most helpful. TIA, Steve -- 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/
