ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIEBitmap memory leak
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

claudio.piffer

Italy
1 Posts

Posted - Oct 22 2022 :  13:20:02  Show Profile  Reply
Hi,

I use last version of ImageEN and doing the resample of an image I noticed a small memory leak.

In the AssignEx method, a TBitmap is created when a Graphics or Picture object is loaded into a TIEBitmap and it's no longer released.

From row 24164:

if ( Source is TGraphic ) or ( Source is TPicture ) then
  begin
    bmp := TBitmap.Create;
    if Source is TPicture then
      bmp.assign( TPicture( Source ).Graphic )
    else
      bmp.assign( TGraphic( Source ));
    CopyFromTBitmap( bmp );
    if bmp.PixelFormat = pf32bit then
      SynchronizeRGBA(True, True);
  end


bmp is no longer released.

I changed the code like this:

if ( Source is TGraphic ) or ( Source is TPicture ) then
  begin
    bmp := TBitmap.Create;
    try <--added
      if Source is TPicture then
        bmp.assign( TPicture( Source ).Graphic )
      else
        bmp.assign( TGraphic( Source ));
      CopyFromTBitmap( bmp );
      if bmp.PixelFormat = pf32bit then
        SynchronizeRGBA(True, True);
    finally <--added
     bmp.free; <--added
    end; <--added
  end


Now work fine without more memory leaks.

Best regards

Claudio Piffer

xequte

38608 Posts

Posted - Oct 23 2022 :  15:08:49  Show Profile  Reply
Thanks Claudio,

Fixed in the current beta.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: