Out of system resources



I process JPG files in a separate thread. One file after another. Sometimes
I get this error "Out of system resources". But the files aren't
particularly big (< 100 kb), all objects involved are properly freed and the
error is not reproducible. But when it happens, it happens always at the
same place:

JPGimage:=TjpegImage.Create;
try
JPGimage.Assign(bitmap);
JPGimage.CompressionQuality:=60;
JPGimage.SaveToFile(destinationFile); //<<<<<< here
except
end;
JPGimage.free

The program counter is at the SaveToFile line when the error is trapped.
I've learned that the error is then in the previous statement. But that
doesn't make sense to me.

Any suggestions?
Tom



.