Welcome! Log In Create A New Profile

Advanced

Memory leak with libfat

Posted by arasium 
Memory leak with libfat
December 18, 2009 05:21PM
Hi,

i think i've found a bug in libfat. I need to read/write a lot of file on the sd card.

My option is to Mount/Unmount the sd card every time i use/unuse it. After a long time, my memory is full (malloc return me null).
The other option is to Mount the sd at the beginning only. With this method, all is fine.


So i think there is a memory leak in the libfat mounting/unmounting system.....

Does someone has a solution? (for information, i need to use the first method in my final release).
Re: Memory leak with libfat
January 03, 2010 08:16AM
anybody?
Re: Memory leak with libfat
January 03, 2010 03:13PM
Go directly bother the guys behind libfat about this: [devkitpro.org]



Edited 1 time(s). Last edit at 01/03/2010 04:13PM by Arikado.
Re: Memory leak with libfat
January 03, 2010 03:40PM
so if you just do main() with a loop like
int pune=0;
while (1)
{
initSdCard();
closeSdcard();
blablabla = malloc();
if(!blablabla)break;
free(blablabla);
printf(".");
pune++;
}

printf("\nthere is no memory left after %d sd card inits", pune);

you are saying that eventually the loop will break and it will be out of memory?
Re: Memory leak with libfat
January 04, 2010 01:04PM
I haven't done this simple test :)
But here is the code i will put in it:

u64 pune=0;
while(1)
{
  __io_wiisd->startup();
  fatMountSimple("sd",  __io_wiisd);
  fatUnmount("sd");
  __io_wiisd->shutdown();

  void* blablabla = malloc(256);
  if(!blablabla)break;
  free(blablabla);
  printf(".");
  pune++;
}
printf("\nthere is no memory left after %d sd card inits", pune);

I will try this test!
Sorry, only registered users may post in this forum.

Click here to login