Good afternoon everyone
What am I trying to accomplish . I would like to implement an extension for the C ++ unit test tool to determine if memory allocates memory and does not free it. My idea was to record distribution levels or free memory levels before and after the test. If they do not match, you lose memory.
What I have tried so far: I wrote a program for reading / proc / self / stat to get the size of vm and the size of the resident set. The size of the resident set seems to me what I need, but this is clearly not the case. It changes between successive function calls without memory allocation. I believe that it returns cached memory, not what is allocated. It also changes in 4k steps, so it is too coarse to be in reality.
I can get the size of the stack by highlighting the local one and saving its address. Are there any problems with this?
Is there a way to get real free or dedicated memory on Linux?
thanks
source
share