Bitmaps width 32bit Colordepth lazarus / 35-Windows CE ---------------------------------------------------------------------- hammster12 · 2010-10-31 13:26 I would like to write a program for Windows CE 5.0. As I begun with use a bitmap with 32bit color than I realised that there is a memoryleak. When I use a 16bit color bitmap than I haven't got this problem. I would like to show the sourcecode of my program: I use an image, a button for exit and a timer. Code: [Select] unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,   ExtCtrls, StdCtrls; type   { TForm1 }   TForm1 = class(TForm)     Button3: TButton;     Image1: TImage;     ImageList1: TImageList;     Timer1: TTimer;     procedure Button3Click(Sender: TObject);     procedure FormCreate(Sender: TObject);     procedure Timer1Timer(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1;   Bitmap01:tBitmap; implementation { TForm1 } procedure TForm1.Button3Click(Sender: TObject); begin   form1.Close; end; procedure TForm1.FormCreate(Sender: TObject); begin      Bitmap01:=tbitmap.Create;      Bitmap01.Width:=100;      Bitmap01.Height:=100;      Bitmap01.PixelFormat:=pf32bit;      Bitmap01.Canvas.Pen.Color:=clred;      Bitmap01.Canvas.Pen.Width:=3;      Bitmap01.Canvas.Brush.Color:=clyellow;      Bitmap01.Canvas.FillRect(2,2,98,98);      timer1.Enabled:=true; end; procedure TForm1.Timer1Timer(Sender: TObject); begin      image1.Canvas.Draw(random(100),random(84),Bitmap01); end; initialization   {$I unit1.lrs} end.             What do I wrong? Thank you for your help in advance! ---------------------------------------------------------------------- Laksen · 2010-10-31 14:37 Where do you call Bitmap01.Free? ---------------------------------------------------------------------- hammster12 · 2010-10-31 16:38 You are right! I forget to write before form1.close; the bitmap01.free. But unfortunately it is not the main problem: When I use Bitmap01.PixelFormat:=pf32bit; then my program will use up the whole systemmemory. It happens always at image1.Canvas.Draw(....); piece by piece. (1. timer event: 100x100x4 bytes remain in memory  2. timer event: 100x100x4+100x100x4 bytes  3. timer event: .... and so on) When I use Bitmap01.PixelFormat:=pf16bit; then I haven't got this problem. But I want to use transparent images which must have a 32bit colordepth (24bit color + 8bit alpha) I hope it's understandable, I'm sorry for my pure English! ---------------------------------------------------------------------- Marc · 2010-10-31 22:35 maybe some internal (widgetset) error. Please bugrep (and if possible with small demo code)