Force GC to run on another application

B

BuddyWork

Hello,

I want to know how I can force a GC to run outside the
application. For example. App1 which is where I want the
GC to be collected. I don't want to run GC.Collect within
this application. I want to create App2 which will call
GC.Collect within App1 some how.

The main reason to force the GC collection is that GEN2
collection is growing very fast and I adventgually get
the OutOfMemory exception. When I force the GC.Collect on
GEN2 in App1 then every thing works. But I don't want to
control it via App1 because if in the future I want to
switch this off then all I have to do is uninstall App2.

Please help,
 
W

Willy Denoyette [MVP]

BuddyWork said:
Hello,

I want to know how I can force a GC to run outside the
application. For example. App1 which is where I want the
GC to be collected. I don't want to run GC.Collect within
this application. I want to create App2 which will call
GC.Collect within App1 some how.

The main reason to force the GC collection is that GEN2
collection is growing very fast and I adventgually get
the OutOfMemory exception. When I force the GC.Collect on
GEN2 in App1 then every thing works. But I don't want to
control it via App1 because if in the future I want to
switch this off then all I have to do is uninstall App2.

Please help,

You can't do this, aand there is no need to call GC.Connect, it will be
called automatically when Gen2 grows.
If you get OutOfMemory exceptions it's because the GC cannot remove objects
from the heap, that means your application has a bug. Only thing you can do
is fix it.

Willy.
 

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