Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I found a memory leak while loading and freeing library contnuously.
When I see the task manager, the memory grow up for this application. I have no memory allocation in my DLLMain. This is the sample code

for (int i=0;i<500;i++)
{
hInstance = LoadLibrary("MySampleDLL.dll");
if (hInstance !=NULL)
{
FreeLibrary(hInstance);
hInstance = NULL;
}
}
Posted

1 solution

First of all, don't trust Task Manager, it's a very inaccurate evidence. What it shows may be not a real time leak.

But if you really afraid of real time leak, don't take changes; consider using some of the products called memory debuggers. Please see, in particular:
http://en.wikipedia.org/wiki/Memory_debugger[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900