My app stays in memory

M

maluman

Welcome

Since my application grew a little, now I have a problem with it. The
problem is, that in whatever way I close it, it stays in memory. Only VS
2003 complaints about 'sharing violation', the application can be normally
rerun on device. My device is Windows CE 4.2. I've read a lot on this group
about PPC, where the form is minimalized instead of being closed. However, I
changed properties "Minimize Box" of all forms to false, then I gave
following code to my Exit button in main form:

this.Dispose();
this.Close();
Application.Exit();

And the application stays in memory (I can see it from Remote Process Viewer
Tool from eVC 4.0).
Help appreciated!

Regards, m.
 
P

Paul G. Tobey [eMVP]

Maybe you have launched a thread which is still running? The application
won't exit if any of its threads are still running.

Paul T.
 
D

Daniel Moth

After following Paul's suggestion, be advised that you only need
<form>.Close, not the other two and most certainly not all 3.

Cheers
Daniel
 
C

Chris Tacke, eMVP

You see no problems with calling Close() on a Disposed object? It wouldn't
produce the behavior you see (that's likely a worker thread) but it's bad
and likely to cause an exception in a deployed situation.

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate
 
M

maluman

Thanks for suggestions. You were all right!

Just for your and my curiousity:

For your curiousity: I didn't launch any thread, I just called my device
producer dll with code:

bool bUser = (Security.GetShellSecurityLevel() ==
Security.SecurityLevel.User);

I found that when I removed that line, the app has successfully removed
itsself from memory. Then I found Security.Dispose() method, which allowed
me to release all resources used by that dll.

For my curiousity: What scenario in your opinion took place? Is it the
problem, that the library was written in unmanaged code, so that garbage
collector couldn't take care of it?

Regards, and thanks again, m
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top