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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIEBitmap memory leak

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
claudio.piffer Posted - Oct 22 2022 : 13:20:02
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
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 23 2022 : 15:08:49
Thanks Claudio,

Fixed in the current beta.

Nigel
Xequte Software
www.imageen.com