Article View: comp.lang.pascal.delphi.misc
Article #304Re: Out Of Resources. Any idea why?
From: Michael P. Schneider
Date: Mon, 10 Dec 2001 21:14
Date: Mon, 10 Dec 2001 21:14
28 lines
2240 bytes
2240 bytes
> procedure TForm1.DisplayScore(ai_Team ,ai_Score : integer);
> var TmpBmp : TBitmap;
> begin
> TmpBmp := TBitmap.Create;
> TmpBmp.Width := ImageScore1.Width;
> TmpBmp.Height := ImageScore1.Height;
> TmpBmp := ScoreBitmap(ai_Score,TmpBmp.Width,TmpBmp.Height);
> ImageScore1.Picture.Bitmap.FreeImage; { usefull?}
> ImageScore1.Picture.Bitmap.Dormant; { usefull?}
> ImageScore1.Picture.Bitmap.ReleaseHandle; { usefull?}
> ImageScore1.Picture.Bitmap := TmpBmp;
> TmpBmp.Free;
> end;
>
> ;------------------------------------------------------------
>
> After displaying the score many times, I get out of resources
> (EOutOfResources). This can only be caused by the created bitmaps. But
> I do not understand why. Please explain.
Given your code it looks like you are creating a bitmap object in this
procedure. You are then "losing" the one you created in this procedure by
overwriting it with the retrurn value of the ScoreBitmap procedure. This is
leaving one TBitmap object unfreed.
Michael P. Schneider
Technical Details
Message-ID:
<1B9R7.11985$DD2.122380@typhoon.sonic.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.mailgate.org!news2.euro.net!uunet!sac.uu.net!feed.news.sonic.net!typhoon.sonic.net!not-for-mailReferences:
<287dc9c0.0112101002.6cbc2cb@posting.google.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10baee,74d708b07592566d X-Google-Attributes: gid10baee,public X-Google-Thread: 1043cf,74d708b07592566d X-Google-Attributes: gid1043cf,public X-Google-ArrivalTime: 2001-12-10 13:15:11 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.mailgate.org!news2.euro.net!uunet!sac.uu.net!feed.news.sonic.net!typhoon.sonic.net!not-for-mail From: "Michael P. Schneider" <michael@sbpaaimt.cybermagician.net> Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.objectpascal References: <287dc9c0.0112101002.6cbc2cb@posting.google.com> Subject: Re: Out Of Resources. Any idea why? Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Message-ID: <1B9R7.11985$DD2.122380@typhoon.sonic.net> Date: Mon, 10 Dec 2001 21:14:37 GMT NNTP-Posting-Host: 208.201.244.8 X-Complaints-To: abuse@sonic.net X-Trace: typhoon.sonic.net 1008018877 208.201.244.8 (Mon, 10 Dec 2001 13:14:37 PST) NNTP-Posting-Date: Mon, 10 Dec 2001 13:14:37 PST