First, you have no assurances that the same memory manager is involved.
For example, the MSVC 'new' allocates memory from Windows in blocks and
then sub-divides them. If this is the case, your app dies.
Second, freeing blocks directly bypasses appropriate destructor(s). You
also bypass overridden new/delete methods. Again, leaks and death.
Last, you make life miserable for the person who has to work on the code
after you. If it is someone you hate, this might be a plus,
otherwise...
Regards,
-jjf
-----Original Message-----
From: Jeff Ishaq [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 10, 2000 12:58 PM
To: Palm Developer Forum
Subject: Mixing MemPtrNew and delete
So what bad things can become of this:
CharPtr myStringP = (CharPtr) MemPtrNew( 50 );
delete myStringP;
And of course this:
CharPtr myStringP = new char(50);
MemPtrFree (myStringP);
Just a passing thought,
-Jeff
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html