Hi Coders,
Well I would like to track some memory leaks in my C++ progs (uses of new and delete).
I tried the "include .h sources" like mem* (don't remember the names), i.e. include some redefinitions of new methods. Not useful here.
I tried to use memguard.
I use it by launching memguard -client name_of_prog (here jeu).
The output is written below :
4 buckets of 1024 used, max chain size 1, avg 1, total 4
512 bytes overhead caused by walls
1 MemHeaders allocated, that's 65504 bytes, 57008 bytes are free
526 allocations were tracked by this program, 522 are already freed
Task: [4] "jeu" (556706C0) -- 583AB040 = AllocVec(1064, 00001000)
LR 01923088 : "Kickstart/dos.library.kmod" offset 0000 segment 33844
CTR 6F8DC950 : "MemGuard" offset 0005 segment 8948
Task: [4] "jeu" (556706C0) -- 586DA040 = AllocVec(1064, 00001000)
LR 01923088 : "Kickstart/dos.library.kmod" offset 0000 segment 33844
CTR 6F8DC950 : "MemGuard" offset 0005 segment 8948
Task: [4] "jeu" (556706C0) -- 583AB9E0 = AllocVec(1064, 00001000)
LR 01923088 : "Kickstart/dos.library.kmod" offset 0000 segment 33844
CTR 6F8DC950 : "MemGuard" offset 0005 segment 8948
Task: [4] "jeu" (556706C0) -- 586DA9E0 = AllocVec(1064, 00001000)
LR 01923088 : "Kickstart/dos.library.kmod" offset 0000 segment 33844
CTR 6F8DC950 : "MemGuard" offset 0005 segment 8948
I have two questions.
First how can I use that output ? I tried to addr2line -e jeu -j .text adresss, but I have the classic ??:0 or the source line of thomas Frieden...
Second what are the use of parameters of memguard ?
I don't really understand them like PreSize and PostSize.
Thanks for your replies.
YesCop
EDIT:
I write here my last investigations and answers from Stephan, the author of Memguard.
The meaning of presize and post size is simple. It is just the size of extra allocated bytes (64 by default) before and after the asked allocated memory.
The goal is to test illegal memory access.
Task: [4] "jeu" (556706C0) -- 586DA9E0 = AllocVec(1064, 00001000)
LR 01923088 : "Kickstart/dos.library.kmod" offset 0000 segment 33844
CTR 6F8DC950 : "MemGuard" offset 0005 segment 8948
I will explain these lines.
556706C0 : address of the task "jeu"
586DA9E0 = AllocVec(1064, 00001000) : address of the allocated memory, 1064 bytes.
01923088 : the link register.
from Stephan : "which usually holds the return address, points
to dos.library, so the allocation wasn't done by your program (it just
happened inside the context of your task/process)."
6F8DC950 :
From Stephan : "Counter register, just like the LR (link register), can be used to perform jumps to other addresses"
So, the LR line is associated to dos.library, the allocation is done by it.
I am happy because I have no memory leaks, I am a good coder :)
But I am worried about that allocation, it may appear that it is not always returned or is it just an illusion ?
Tue, 2011-05-17 15:23
#1
Track memory leaks and Memguard (solved? and some infos)