memory allocation
Hello everyone ;-)
I wrote a small app in c++, (an html parser, based on tidylib). My primary problem is an ugly memory leak. I tried valgrind but it shows fairly large amounts of memory as possibly lost or stiil reachable. Finally I wrote a small function that parses /proc/<my_app_pid>/status from where I get the VmRSS memory (also returned by top -p <my_app_pid>). I see that the memory gets allways allocated in blocks of 4K (even if at any given time my code doesn't ask that much memory at once ...), but never gets deallocated. Even if am using local variables, (i.e. stl maps, strings wich should be created and destroyed, every time the parser function is called) the memory increases continuosly. Please help. |
maybe this will help you track down the leaks.
Code:
/*============================================================================= edit-- the error func referenced in this file is: Code:
#define error(X) std::cout <<"Error: " <<X <<std::endl <<"\tfile: "<<__FILE__ <<std::endl << "\tline: "<<__LINE__ <<std::endl; and this file doesnt check that a valid pointer is returned, its just for debug purposes. |
thank you dmail ;-) i will try this !
|
All times are GMT -5. The time now is 09:51 AM. |