Vineet Bansal
Vineet Bansal

Reputation: 501

Can I use valgrind to limit heap size to my program?

I'm new to valgrind and I was wondering if I can invoke valgrind in such a way that it causes my mallocs to fail for lack of available memory.

Something like: $valgrind helloworld --heapsize=10

Upvotes: 5

Views: 1275

Answers (1)

user149341
user149341

Reputation:

No, valgrind tries to not interfere with the operation of your program. You should be able to use ulimit -d to restrict the amount of memory available to your program, though, independent of valgrind.

Upvotes: 4

Related Questions