Any way to force memory usage with an application under Mono?

I'm running CentOS 5.5 and Mono 2.10 on a VPS in which I have root access too.

I have a large java app that is set to use no more than 3GB of ram where I have 4GB of ram in total.

I have another app that has to use Mono but it ends up using up all the physical ram and running into the swap eventually killing the server.

Is there anything I can do to limit the amount of ram that the app under Mono will use?

Thanks!

Well, JAVA is limited in VM but not in RAM, but if it needs 3G for a working set . . . . Do you run out of swap? Can you make more? Does nice help at all? With too little RAM, someone will be stuck thrashing, all will page more, but the system should survive if swap is not exhausted.

Well what happened was the server stopped responding completely, as in I couldn't even connect to the terminal via SSH. This is after I started up the second app under Mono. This app is semi-known to have the occasional memory leak (it's pretty rare).

Once the server started working again, on its own, everything returned to it's current state without having to restart any of the background services. Which confused me.

I'm still a novice to linux and I am unsure how to check the logs to find out if I ran out of swap. Also, I am unable to make more swap, the size is defined by my hosting package.

When swap is exhausted, the machine is not friendly to new processes, so I usually leave a VNC desktop running with multiple xterms so I can hook up and see. When the swap hog dies, the swap is returned. Memory leaks do not confuse UNIX, they just make the app use excessive VM = swap. There are several ways to make more swap and install it, if you have root. You can make big flat files on any writable device and add them to swap, or add whole raw devices (partitions). I would Google for the methods, since I am not root very often these days. Having swap on many devices may make it faster.