Pelles C forum

C language => User contributions => Topic started by: Grincheux on April 14, 2021, 07:28:30 AM

Title: Memory Leaks
Post by: Grincheux on April 14, 2021, 07:28:30 AM
Small functions to help to detect memory leaks.
It uses VirtualAlloc and creates a database where you can see the result of VirtualAlloc and VirtualFree

Example:
Code: [Select]
#ifdef __MEMORY_LEAKS__
   _lpImageInfos = (LPIMAGEINFOS) MemoryLeaks_Alloc(__LINE__,"LoadImageFromFile",sizeof(IMAGEINFOS) + 1024) ;
#else
   _lpImageInfos = (LPIMAGEINFOS) VirtualAlloc(NULL,sizeof(IMAGEINFOS) + 1024,MEM_COMMIT|MEM_RESERVE,PAGE_READWRITE) ;
#endif
   if(_lpImageInfos)

and the result:
Quote
RecNo   Action   LineNumber   Function   MemorySize   Address   Result
1   VirtualAlloc   3250   CreateFilter   3991   A6F30000   1
84   VirtualFree   4584   Main_OnDestroy   0   A6F30000   1
2   VirtualAlloc   1425   LoadImageFromFile   26088   A6F50000   1
83   VirtualFree   1540   ImageFree   0   A6F50000   1
73   VirtualAlloc   3350   SaveDatas   32768   A6F60000   1
74   VirtualFree   3425   SaveDatas   0   A6F60000   1

If that can help you...
Title: Re: Memory Leaks
Post by: bitcoin on April 14, 2021, 12:32:13 PM
Thank you, good thing. Will be test it.
But where I can get #include "crc64speed.h" ?
Title: Re: Memory Leaks
Post by: Grincheux on April 14, 2021, 12:34:53 PM
Don't need it, remove the include.


This a file for computing a crc on 64 bits.
I join them if they can help you.