www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - best memory profiler (to debug accumulated allocation of each line)

reply mw <mingwu gmail.com> writes:
Hi,

With CPU profiler, we can see the accumulated run time of each 
function & line, I'm wondering if there is such a profiler for 
memory allocation?

The reason I'm asking is because I suspect there are some small 
but repetitive memory allocation going on in the libraries (in C 
and D) I'm using which I do not have control (and no source 
available), but I want to find out where.

I want to run on some test data, and get the memory allocation 
stats for each function (better for each line of code), so I can 
find out where the problem is.

Any suggestions?

Thanks.
Oct 14 2022
parent reply rassoc <rassoc posteo.de> writes:
On 10/14/22 20:45, mw via Digitalmars-d-learn wrote:
 Any suggestions?
There's `dmd -profile=gc` or `dub build --build=profile-gc`.
Oct 14 2022
parent mw <mingwu gmail.com> writes:
On Friday, 14 October 2022 at 19:06:12 UTC, rassoc wrote:
 On 10/14/22 20:45, mw via Digitalmars-d-learn wrote:
 Any suggestions?
There's `dmd -profile=gc` or `dub build --build=profile-gc`.
Thanks. I eventually use valgrind --tool=massif, and found the problem was in a underlying C library doing lots of small allocations.
Oct 14 2022