Limiting the size of the managed heap in a C# application

Posted by Assaf Lavie on Stack Overflow See other posts from Stack Overflow or by Assaf Lavie
Published on 2009-10-28T07:56:30Z Indexed on 2010/05/11 20:44 UTC
Read the original article Hit count: 328

Filed under:
|
|

Can I configure my C# application to limit its memory consumption to, say, 200MB? IOW, I don't want to wait for the automatic GC (which seems to allow the heap to grow much more than actually needed by this application).

I know that in Java there's a command line switch you can pass to the JVM that achieves this.. is there an equivalent in C#?

p.s.

I know that I can invoke the GC from code, but that's something I would rather not have to do periodically. I'd rather set it once upon startup somehow and forget it.

© Stack Overflow or respective owner

Related posts about c#

Related posts about garbage-collection