[Nvwa-users] nvwa crash on delete
Status: Beta
Brought to you by:
adah
From: Manuel M. <mm...@ce...> - 2008-05-21 21:06:42
|
Hello Yongwie I'm using your nvwa. I think it's good and quick. I tell you some comments on it. Please, forgive me it they seem to you lowed-skilled. I develop on win XP I use mingw with gcc 4.2.1 I use wxWidgets. It is fantastic. I use Code::Blocks IDE I attached debug_new.cpp to my project and re-build it all. In order to get results from stderr, I execute from command line: >C:\progs\myprog\bin\debug\myprog >res.txt 2>&1 Now myprog crashes on exit. Using gdb, I got to debug_new.cpp line 582, inside free_pointer function. When I read res.txt, I can see a lot of leaks that are deleted later on. I gave a name to new_progname and then addr2line worked and showed that most of those lot of leaks came from wxWidgets. They are no really leaks because they all are deleted later. wxWidgets team takes good care on coding without memory leaks. Debuggin more, I see some calloc calls. But nvwa does not treat them. So, first thought: why 'calloc' and 'realloc' are forgotten? But 'free' is not. So, 'free' will try to manage an addr that is not stored in new_ptr_list and crash. And what about bad code allocating with 'malloc' and freeing with 'delete'? They will no be catched if debug_new.h is not included. I changed 'new_verbose_flag' to 'true', commented out lines 582-586 and started again. Now it crash inside alloc_mem(), as soon as it gets to line 499. I'm really lost. Other thoughts on my own are: - May you documentate, out of debug_new.cpp, the usage and what defines user should change. I think doxigen is not useful for this. - addr2line is nasty slow in XP, because of opening/closing a cmd-window for each addr. I looked inside wxExecute, a function to do shell calls. It is no easy. Even more dificult for a portable code like yours. - Why ALIGNMENT and TAILCHECK are needed? - Why 'ptr' and 'pointer' point to moreless the same addr? Oh, yes. These two questions rely on direct and quick access to new_ptr_list, instead of using a hash for example. I don't know how secure is this for diferent compilers. - Why don't you check, before freeing it, ptr to be a valid addr? - You have total_mem_alloc. Please, show it. And show a "still_allocated_mem" value. Well, total_mem_alloc is really "still_allocated_mem" and not "max_mem_needed". - How did you decided MAGIC to be that special value? Anyhow, I like your nvwa. It catches some leaks on my code. It's much quicker than FluidStudios MMGR. It doesn't rely on MS debug dll. It's portable, Valgring is not. Thank you. Manolo |