Steve,

Laurent in no longer maintaining WIN32::GUI::DIBitmap, and it's in the Win32::GUI repository.

I've had a quick look at the source, and it appears there is indeed a leak, which matches your described symptoms:

- If there is no transparency in the image, then AlphaCOpyToDC uses exactly the same code as CopyToDC, so no leak. - As soon as there is some transparency, then it looks like it will leak about the size of the bitmap (width of bitmap * height of bitmap * 4 bytes per call plus a bit of overhead).

The fix is simple. I'm hoping to get a beta release of 1.04 (which I will add this fix to) up for download later today - you might like to download it and see if it fixes this problem?

Regards,
Rob.

Steve Loughran wrote:
OK, some more on this memory leak issue.

If I change the code from using AlphaCopyToDC() to using CopyToDC() (Havent changed anything else in the code at all), the memory leak stops... completely. If I put AlphaCopyToDC() back in again, the leak reappears.

Odd.... i`ll try to write a small code sample with some images and put them all in a zip so someone else can try it (just to save my sanity).

Is Laurent Rocher a subscribed member on the win32-gui mail list?

Steve


Steve Loughran wrote:
Strict - yes, all the time
warning - most of the time :)

I think I have tracked the leak down to the window_paint routine, and specifically to the DIBitmap routine AlphaCopyToDC(). I need to do some more fixed tests, but to me it looks like a problem with Alpha channels in DIBitmap structures, or maybe just DIBitmap structures loaded from PNG files.... or both :)

In window_paint, I call AlphaCopyToDC() to paint a solid image into the $memDC (no memory leak), but when I use the same routine to paint a load of smaller images that contain transparency layers via AlphaCopyToDC() into the $memDC, the memory leak starts appearing. If I comment out just this one call from the foreach loop (and leave everything else running), the leak doesnt happen.

- Active Perl 5.8.6
- Win32-GUI-DIBitmap [0.15]

Need to find some transparent images to use as background image, and see if the leak starts again.

Steve

Emmanuel E wrote:
are you already using use strict? if not use it and cleanup every warning.

threads generally have all kinds of memory problems so if ur using threads life becomes very difficult.

Steve Loughran wrote:
Hi all

Not strictly a win32-gui related question. How would I go about tracking down my memory usage in a perl script? I have a small memory leak in my code somewhere, but no idea where to start looking for clues.

Anyone got any pointers or tips?

Steve

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/



Reply via email to