FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

lodepng memory leak? (holding on to a buffer reference?)

 
Post new topic   Reply to topic     Forum Index -> tango.scrapple
View previous topic :: View next topic  
Author Message
Abscissa



Joined: 23 Feb 2005
Posts: 40
Location: Cleveland, OH, US

PostPosted: Fri May 15, 2009 10:57 pm    Post subject: lodepng memory leak? (holding on to a buffer reference?) Reply with quote

I may very well be doing something wrong here, but I'm having trouble getting images loaded by lodepng to be collected by the GC. Consider the following:

Code:

import tango.core.Memory;
import tango.io.device.File;
import lodepng.Decode;

void main()
{
   ubyte[] stuff;
   PngInfo info;

   // Yea, you'll want to kill this app manually
   for(int i=0; i<100_000; i++)
   {
      // "test.png" is just some 600k png I grabbed

      // Line A
      //stuff = cast(ubyte[])File.get("test.png");
      
      // Line B
      //stuff = decode(cast(ubyte[])File.get("test.png"), info);

      // Clear everything
      stuff = [];
      info = PngInfo();
      GC.collect();
   }
}


If I uncomment line A, compile and run, then memory usage grows to just under 4MB and stays there. But if I uncomment line B instead, then memory usage keeps growing. I killed it somewhere between 300MB and 400MB at which point it was still noticeably growing, but much more slowly (I assume it's just the collection attempts taking longer because of the extra memory to be searched through).

FWIW, I'm using WinXP 32-bit, DMD 1.043, Tango 0.99.8, and umm, whatever version of lodepng was installed when I did "dsss net install lodepng -doc" just yesterday.
Back to top
View user's profile Send private message
Lutger



Joined: 25 May 2006
Posts: 91

PostPosted: Tue Jun 09, 2009 1:56 am    Post subject: Reply with quote

Hi, sorry for the late response. Lodepng is part of scrapple not tango.scrapple, so posting in that forum will increase the odds for me noticing it (or rather email me, I appreciate that).

Unfortunatly I couldn't reproduce this leak on linux with dmd 1.041 and Tango 0.99.8. I'll try to setup a d install on my XP box.

Lodepng doesn't hold any references to anything so it shouldn't prevent GC collections.
Back to top
View user's profile Send private message
Abscissa



Joined: 23 Feb 2005
Posts: 40
Location: Cleveland, OH, US

PostPosted: Tue Jun 09, 2009 3:58 am    Post subject: Reply with quote

Lutger wrote:
Hi, sorry for the late response. Lodepng is part of scrapple not tango.scrapple, so posting in that forum will increase the odds for me noticing it (or rather email me, I appreciate that).


Sorry, I didn't realize they were separate projects.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> tango.scrapple All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group