3

I have a code executable as "demonstrate"> I want to have a neat memory profiling for thios executable. I have gone through the valgrind's massif tool and found out to be something which could fetch me results that I am looking for. Although there is a slight issues I am coming across.

My executable takes various arguments and w/o it it wont run e.g ./demonstrate -t 10 -p 1 -P 3

As soon as I run massif on the above statement it tells me "Error allocating heap"

taskset -c 0-10 valgrind --tool=massif  ./demonstrate -t 10 -p 1 -P 3
==4140== Massif, a heap profiler
==4140== Copyright (C) 2003-2010, and GNU GPL'd, by Nicholas Nethercote
==4140== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==4140== Command: ./demonstrate -t 10
==4140==
Error allocating heap
==4140==

Quite similar issue happened with mtrace. Included mcheck header and called mtrace and muntrace at the beginning and end and tried calling demonstrate e.g

mtrace ./demonstrate -t 10 -p 1 -P 3 -f file.txt mALLOCoUT.TXT

Wrong number of arguments, run /usr/bin/mtrace --help for help. at /usr/bin/mtrace   line    89.

Although when I run the application without the valgrind option the application runs fine:

./demonstrate -t 10 -p 1 -P 3
Opened 1
Opened 2
Opened 3
Allocated huge page size=1073741824
Pushed 262144 pages

Any suggestion on how to get any of these working with several command line arguments.

4

0 回答 0