Board index » delphi » D1 Bug: Timage causes memory leak

D1 Bug: Timage causes memory leak

On Tue, 07 Jan 1997 19:24:33 +0100, Rolf Peder Klemetsen

Quote
<r...@animax.no> wrote:
>There seems to be a bug in Delphi 1.0 that causes a memory leak when
>using the TImage component with bitmaps that have a size which is a
>multiple of 64KB (e.g 768 X 512 with 256 colors). Delphi 2.0 does not
>have the same bug. I have installed the newest patch from
>ftp.borland.com but the problem has not been fixed.
>Does anybody know have a solution ?

This is a known problem with any graphical image whose data size is an
integral multiple of 64K. The solution is to edit Graphics.pas. Look
for all the uses of MemAlloc. Change the FreeMem calls that free the
MemAlloc-ed memory to use MemFree:

procedure MemFree(Ptr: Pointer; Size: LongInt);
begin
  if Size > $FFFF then
    GlobalFreePtr(Ptr)
  else
    FreeMem(Ptr, Word(Size))
end;

For more information, search a news archive.
--
Ray Lischner, Tempest Software, Inc., Corvallis, Oregon, USA
Author of Secrets of Delphi 2 (http://www.tempest-sw.com/secrets/)

 

Re:D1 Bug: Timage causes memory leak


There seems to be a bug in Delphi 1.0 that causes a memory leak when
using the TImage component with bitmaps that have a size which is a
multiple of 64KB (e.g 768 X 512 with 256 colors). Delphi 2.0 does not
have the same bug. I have installed the newest patch from
ftp.borland.com but the problem has not been fixed.
Does anybody know have a solution ?

--
Rolf Peder Klemetsen
AnimaX International AS
Mailto:r...@animax.no
http://www.animax.no

Other Threads