how to find memory leak
I''m making a model loader and using dynamic memory allocation(malloc & realloc) to allocate memory during importing the model. Then there''s a function to destroy the model using free() function. I did a test to monitor memory leak when I repeatedly import and destroy a model. I used norton systemwork to monitor the PHYSICAL memory used. Everytime I import the model the memory used will increase but when I destroy the model, the memory used will decrease less than it increased(differs by around hundred kilobytes)... so I guess there''s a memory leak in my program...
Is this the correct way to monitor memory leak? How to make a program that can calculate how much memory leak it has ?
Use a memory manager. I sent you an email with one memory manager ready to use. Just include "Memory_Manager.h" after the <> includes and that''s it.
Example:
#include <windows.h>
#include <stdio.h>
#include "Memory_Manager.h"
// The rest of your includes goes here.
Hasta
Example:
#include <windows.h>
#include <stdio.h>
#include "Memory_Manager.h"
// The rest of your includes goes here.
Hasta
"Outside there are tricks and evil."http://go.to/3dprog
How do the memory managers work? Do they redefine the new/malloc function?
PM
PM
PM Times change...
Excuse my poor english!
They redefine new, new[], delete, delte[], malloc, realloc, calloc and free.
Hasta
Hasta
"Outside there are tricks and evil."http://go.to/3dprog
Cool, would you mind posting those on the forums? I''m sure they would come in useful for everyone here
.

quote:
Original post by Mr_Mav
Use a memory manager. I sent you an email with one memory manager ready to use. Just include "Memory_Manager.h" after the <> includes and that''s it.
Do you know where can I find a memory manager on the web ?
Paul Nettle (Midnight) wrote a good (free) memory manager...
Here''s some stuff from the readme file :
"This code originally appeared on www.flipcode.com as an entry to the "Ask Midnight" column titled "Presenting A Memory Manager":
http://www.flipcode.com/askmid/archives.shtml "
And
"You can find the latest version of this source at:
ftp://ftp.GraphicsPapers.com/pub/ProgrammingTools/MemoryManagers/
!IMPORTANT! Please spend just a couple minutes reading the comments at the top of the mmgr.cpp file... it will save you a lot of headaches!"
We scratch our eternal itch
A twentieth century bitch
We are grateful for
Our Iron Lung
Here''s some stuff from the readme file :
"This code originally appeared on www.flipcode.com as an entry to the "Ask Midnight" column titled "Presenting A Memory Manager":
http://www.flipcode.com/askmid/archives.shtml "
And
"You can find the latest version of this source at:
ftp://ftp.GraphicsPapers.com/pub/ProgrammingTools/MemoryManagers/
!IMPORTANT! Please spend just a couple minutes reading the comments at the top of the mmgr.cpp file... it will save you a lot of headaches!"
We scratch our eternal itch
A twentieth century bitch
We are grateful for
Our Iron Lung
We scratch our eternal itchA twentieth century bitchWe are grateful forOur Iron Lung
quote:
Original post by slyterence
...You can find the latest version of this source at:
ftp://ftp.GraphicsPapers.com/pub/ProgrammingTools/MemoryManagers
That link doesn''t work for me...
I googled it and found this one tho
"If you gaze long into an abyss, the abyss will gaze back into you."
- Friedrich Nietzsche (1844-1900)
(my site)
MSN: stupidbackup@hotmail.com (not actual e-mail)ICQ: 26469254(my site)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement