Howdy, gang. Got a question for the group...Hopefully someone here can help me figure out this little puzzle.



The following is a simple function that makes an Imlib image (a little icon) flash X number of times.
This function leaks memory like crazy.. I've pinned it down to Imlib_paste_image().
Any ideas as to what i'm forgetting to do here? The code is as follows:




// (Note: "buffer" and "bufferData" are analogous to "im" and "id" in your examples, respectively... and "icon[0].image" is analogous to "im".)

void strobeThisIcon(int uniqueID, int strobeCycles)
{
       int originalBrightness;

       buffer=icon[0].image;
       Imlib_get_image_modifier(bufferData,buffer,&mod);
       originalBrightness=mod.brightness;

while(strobeCycles!=0)
{
while(mod.brightness<320)
{
Imlib_set_image_modifier(bufferData,buffer,&mod);
Imlib_paste_image(bufferData,buffer,win,0,0,64,64);
mod.brightness=mod.brightness+25;
}



while(mod.brightness>=originalBrightness)
{
Imlib_set_image_modifier(bufferData,buffer,&mod);
Imlib_paste_image(bufferData,buffer,win,0,0,64,64);
mod.brightness=mod.brightness-25;
}


                       strobeCycles--;
       }

XSync(disp,False);

}


PS.. If you want to see the leak in action, grab the latest Pogo:


http://www.ibiblio.org/propaganda/pogo/pogo-2.1.tar.gz

...and hardwire main() to just hit strobeThisIcon() in an infinite loop.

Build it, and have a look at it in memprof. Leak city.

Cheers,
Bowie



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to