Sridhar Iyer
Sridhar Iyer

Reputation: 2840

Limiting resource usage for debugging an application on linux

I have a C/C++ application that crashes only under heavy loads. I normally use valgrind and gprof to debug memory leaks and profiling issues. Failure rate is like about 100 in a million runs. This is consistent. Rather than reproduce the traffic to my application, can I superficially limit the resources available to the debug build of the application running within valgrind somehow?

Upvotes: 2

Views: 219

Answers (3)

Zan Lynx
Zan Lynx

Reputation: 54325

Note that in Linux only some of the memory ulimits actually work.

For example, I don't think ulimit -d which is supposed to limit the data segment (which I think is RSS) really works.

As I recall from my experience with trying to keep Evolution (the email client) under control, ulimit -v (the virtual memory) was the only one that worked for me.

Upvotes: 1

caf
caf

Reputation: 239011

It sounds like it could be a race condition - have you tried the 'helgrind' valgrind tool?

Upvotes: 0

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798566

ulimit can be used from bash to set hard limits on some resources.

Upvotes: 2

Related Questions