LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Using jemalloc's memory profiler (http://www.linuxquestions.org/questions/programming-9/using-jemallocs-memory-profiler-4175410991/)

demon007 06-12-2012 04:24 AM

Using jemalloc's memory profiler
 
I am trying to use jemalloc's memory profiler in my code to get the idea of how memory allocation is happening in it.

I have installed jemalloc using the prefix "--enable-prof" but while compiling my code, I was getting undefined reference for "mallctl".

I am not able find which library I have to link to make it work.

Please help me. I am trying this for over three weeks.

Thank You.

pan64 06-12-2012 11:32 AM

I found no documentation about it, but probably you only need to compile with -ljemalloc. But you would give more info to help: what have you tried, what's happened....








__________________________________
Happy with solution ... mark as SOLVED
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.

demon007 06-13-2012 03:03 AM

Hi pan64,

thanks for your reply.

I have compiled jemalloc using the option --enabel-prof.

I am trying jemalloc in a small code which is allocating 1GB of memory. I tried to compile the code with -ljemalloc and it is working but the problem is that, it is not creating heap profile of the code.

I require to use the heap profiler that jemalloc has included in it but cant find any documentation regarding how to implement it.

pan64 06-13-2012 03:23 AM

I found no other documentation, just the official one and this: https://bugzilla.mozilla.org/show_bug.cgi?id=627206. Probably it helps. You do not need to implement anything, just switch it on and look at the result.





__________________________________
Happy with solution ... mark as SOLVED
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.

demon007 06-13-2012 04:08 AM

Thanks it helped a lot.

And just for the record:
We have to compile jemalloc with --enable-prof.

The code in which jemalloc is to be used has to be compiled with -ljemalloc.

To create heap profiler, execute use the following command:

MALLOC_CONF=prof:true [command in which jemalloc has to be used]

pan64 06-13-2012 04:29 AM

glad to hear that.
Probably you can ask them to release a much better documentation also.





____________________________
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.


All times are GMT -5. The time now is 12:13 AM.