Tom
Tom

Reputation: 8180

Any way to wall off a thread's memory area?

I have a process which leaks memory. I know the causes of this, and have a solution. This is not what this question is about.

One way of removing the destructive effect of the memory leak would in my case be to run the many instances of this process, literally in separate processes, letting each one run its course and die a natural death, as it were. (each one only leaks a couple of megs)

However, this seems to involve a lot of overhead.

Any way to create a memory 'wall' in .NET? (other than to spawn a process) - Such that everything inside that wall could be torn down at will.

Of course, there are contrived answers to this involving some kind of meta memory system; not really what I'm looking for, unless it is super clever :)

Please no comments about how I should just fix the memory leak. (It's in the .NET framework)

Upvotes: 1

Views: 134

Answers (2)

Joel Coehoorn
Joel Coehoorn

Reputation: 415880

Look into Application Domains, though I also entreat you to fix the root cause of the issue.

Upvotes: 4

Mitch Wheat
Mitch Wheat

Reputation: 300579

Treat the cause, not the symptoms!

Can you prove there is a leak in the framework (and have you submitted a Connect issue)? It's much more likely to be a memory leak in your code.

Download memprofiler, Redgate Ants or dotTrace (all have trial versions) and find and fix the actual problem.

Upvotes: 6

Related Questions