News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Memory leaks

Started by ragdog, June 20, 2015, 07:51:28 PM

Previous topic - Next topic

ragdog

Hello

I search a good tool to find in my projects ( or other programs) Memory leaks.
Gives a good tool or Olly plugin to detect memory leaks?

Greets,

dedndave

there is one called "WinLeak"
not sure how good it really is - it will probably detect the ones you should have caught to begin with - lol

good code is the best defense   :t

ragdog

#2
Thank you Dave i try it

Quotegood code is the best defense

hehe ist not all open source :biggrin:

EDIT:
I have try winleak 1.1.3 http://winleak.sourceforge.net/ with a simply Masm32 and C example
Without good result it create not any Logfile.


#include <stdlib.h>

void function_which_allocates(void) {
    /* allocate an array of 45 floats */
    float *a = malloc(sizeof(float) * 45);

    /* additional code making use of 'a' */

    /* return to main, having forgotten to free the memory we malloc'd */
}

int main(void) {
    function_which_allocates();

    /* the pointer 'a' no longer exists, and therefore cannot be freed,
     but the memory is still allocated. a leak has occurred. */
}


or


#include <stdlib.h>

int main(void)
{
   int *a; /* Zeiger auf einen als Ganzzahl interpretierten Speicherbereich */

   /* Speicher für Zeiger reservieren. */
   a = malloc(sizeof(int));
   /* ... */
   a = malloc(sizeof(int));   /* Zeiger auf zuvor allozierten Speicher wird überschrieben. */

   free(a);  /* Nur der zweite Speicherblock wird freigegeben --> Speicherleck */

   return EXIT_SUCCESS;
}


Have any an idea or gives a good Olly Plugin?