Board index » delphi » Q: TBitmap eats memory when creating Handle

Q: TBitmap eats memory when creating Handle

I forgot to say, that I use Delphi 1.0 (1.5 to be excact).

The following code has given me some problems:

var
  Bmp : TBitmap;
  TmpHandle : HBitmap;

begin
  Bmp := TBitmap.Create;
  Bmp.LoadFromFile('PICTURE1.BMP');
  TmpHandle := Bmp.Handle;
  Bmp.LoadFromFile('PICTURE1.BMP');  <--------
  TmpHandle := Bmp.Handle;           <--------
  Bmp.Free;
end;

Somewhere in the two marked lines, Delphi eats some memory.
My theory is, that the old Handle (i.e. the old Windows-bitmap) is NOT
deleted. Has anybody experienced this?

-- Carsten

---------------------------------------------------------------

"The Dungeon" - RPG homepage: http://inet.uni-c.dk/~alvion/

 

Re:Q: TBitmap eats memory when creating Handle


The following code has given me some problems:

var
  Bmp : TBitmap;
  TmpHandle : HBitmap;

begin
  Bmp := TBitmap.Create;
  Bmp.LoadFromFile('PICTURE1.BMP');
  TmpHandle := Bmp.Handle;
  Bmp.LoadFromFile('PICTURE1.BMP');  <--------
  TmpHandle := Bmp.Handle;           <--------
  Bmp.Free;
end;

Somewhere in the two marked lines, Delphi eats some memory.
My theory is, that the old Handle (i.e. the old Windows-bitmap) is NOT
deleted. Has anybody experienced this?

-- Carsten

---------------------------------------------------------------

"The Dungeon" - RPG homepage: http://inet.uni-c.dk/~alvion/

Other Threads