I want to test my Java and C programs for memory usage for which I'm trying to restrict the memory available to a dummy user.

I've tried using the ulimit -d 10; ulimit -l 10 and ulimit -v 10 commands. The ulimit -d 10; ulimit -l 10 are ineffective; in that they're allowing the dummy user to use up more memory than 10Kb. The ulimit -v 10 is resulting in "Killed" appearing whenever I run my program.

I've tried the same thing by modifying the /etc/security/limits.conf file like this:

dummy hard memlock 10

but that doesn't work either.

So my question is, how do I ensure that any program that my dummy user runs, never uses more than 10Kb (or any such number) of memory?

Also, if anyone here knows of some other tools that do the same (restrict memory usage/monitor & report program performance), please feel free to recommend them.


Thanks,
Prashant.