Check your own code ;-)
1. Try to avoid using dynamically created objects, for example:
A* pa = new A();
pa->Foo();
delete pa;
Replace with:
A a;
a.Foo();
2. Use smart pointers (CAutoPtr and CSmartPtr) if it's difficult to
track objects lifetime.
______________________________________________
Best regards,
Maks Pyatkovskiy
> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:bounce-palm-dev-
> [EMAIL PROTECTED] On Behalf Of Nick
> Sent: Monday, June 30, 2003 9:16 PM
> To: Palm Developer Forum
> Subject: Memory Leaks from POL objects after adding a segment and
> reordering modules.
>
> I am using POL 4.04.00 and CW 9.1. My application was created using
the
> POL
> stationary.
>
> I recently had to add a segment to my application because the first
> segment
> exceeded 64k and I was getting compiler errors. The users of this
forum
> kindly helped me through this. I added Segment 5 as Preload,
Protected,
> Locked. I chose these values because all the other segments had these
> values.
>
> Now that I have added the segment, I am getting a huge amount of
memory
> leaks from some of the POL objects that I am using in my application.
The
> leaks happen when exiting the application. (invoke app, invoke a/b
form,
> tap
> the home icon).
>
> For example, on Form A, I have a tree control that will have several
> hundred
> leaks depending on how many items I put in the tree.
>
> Another example, in Form B, is assiging a local POL pointer variable
to an
> externally defined object in OnOpen. My code for this was taken right
> from
> the POL documentation examples and has been working up until I changed
the
> segmentation.
>
> // example
> CMyForm::OnOpen(...)
> {
> CMyApp *pApp = (CMyApp *) CMyApp::GetInstance();
>
> m_pADatabase = pApp->GetADatabase();
> // if I put return here, 2 memory leaks
>
> m_pBDatabase = pApp->GetBDatabase();
> // if I put return here, 3 memory leaks
>
> m_pCDatabase = pApp->GetCDatabase();
> // if I put return here, 4 memory leaks
>
> ... other stuff...
>
> return false; // 4 memory leaks.
> }
>
> I have regressed to an earlier 4 segment application and everything
works
> as
> expected. I would like to avoid having to regress and start again
from
> the
> 4 segment version.
>
> Any suggestions?
>
> Thanks,
> Nick.
>
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/