Re: Out of system resources
- From: "Tom de Neef" <tdeneef@xxxxxxxx>
- Date: Fri, 17 Nov 2006 19:28:44 +0100
"Bart" <broersma.juda_ANTISPAM_@xxxxxxxxxx> schreef in bericht
news:s4trl2tnonkt76dkalobt46nefqadiulp9@xxxxxxxxxx
Op Thu, 16 Nov 2006 23:51:21 +0100 schreef "Tom de Neef"
<tdeneef@xxxxxxxx>:
procedure CopyImageToSize(sourceFile,destinationFile : string;
width,height
: integer);
// Read sourceFile and extract to bitmap in predetermined scale.
// Export to jpg.
var
ext : string;
bitmap : Tbitmap;
JPGimage : TjpegImage;
rect : Trect;
begin
bitmap:=Tbitmap.Create;
try
rect.Left:=0;
rect.Right:=width;
rect.Top:=0;
rect.Bottom:=height;
ext:=Uppercase(extractFileExt(sourceFile));
if (ext='.JPG') OR (ext='.JPEG') OR (ext='.BMP')
then CopyImageToBitmap(sourceFile,bitmap,rect)
else ; // skipped for this post
Just a wild guess here.
If you exit this procedure when extension is not jpg, jpeg or bmp,
then bitmap.free will not be called, so you have a memory leak???
The ELSE clause was omitted here. It handles other image extensions. No
leaks.
I've never worked with threads, so if the problem lies there, I won't
be able to give any reasonable answers...
I now think the problem is indeed related to the thread. One time I got a
different error message at the same spot: "unable to write file". That got
me thinking. The thread produces images that are called in html <img> tags.
While the thread is still active, the main thread's browser tries to load
the html, and thus it may try to read an image while it is being created or
modified.
I now redo the image at the end of the loop when it was involved in such an
error and the out of resources error never repeats.
Tom
.
- References:
- Out of system resources
- From: Tom de Neef
- Re: Out of system resources
- From: Bjørge
- Re: Out of system resources
- From: Tom de Neef
- Re: Out of system resources
- From: Bart
- Out of system resources
- Prev by Date: Re: Learning recursion with hailstone seqence
- Next by Date: Grids ?
- Previous by thread: Re: Out of system resources
- Next by thread: Learning recursion with hailstone seqence
- Index(es):
Relevant Pages
|