xor2
Programmer
- Mar 24, 2005
- 22
Hello,
I have a procedure which performs some operation on jpg file (like transformations, etc).
I am;
- reading pixel from canvas
ACanvas.Pixels[X,Y];
- drawing on canvas
Bitmap.Canvas.Draw(0,0,jpg);
- assign bitmap from another source
Bitmap.Assign(LBitmapPomn);
The problem is that when i Run this procedure in a one thread everything is perfectly allright. I don't have memory leaks nor I have increased number of GDI objects and
the memory in the process manager varies from 50 to 100 mb and after this it returns to its default value.
The problem starts when i want to run this procedure in 4 threads. I have memory leaks. Memory inscreased to 1.7 gb, gdi +500 objects and so on..
I know only that Graphics32 component is thread-safe.
What about TBitmap, TJpegImage?
Which operation with this classes I should "Lock", should I lock?
Could the memory leak occur because of using these components?
How Can i fix my code?
Thanks for help in advance..
I have a procedure which performs some operation on jpg file (like transformations, etc).
I am;
- reading pixel from canvas
ACanvas.Pixels[X,Y];
- drawing on canvas
Bitmap.Canvas.Draw(0,0,jpg);
- assign bitmap from another source
Bitmap.Assign(LBitmapPomn);
The problem is that when i Run this procedure in a one thread everything is perfectly allright. I don't have memory leaks nor I have increased number of GDI objects and
the memory in the process manager varies from 50 to 100 mb and after this it returns to its default value.
The problem starts when i want to run this procedure in 4 threads. I have memory leaks. Memory inscreased to 1.7 gb, gdi +500 objects and so on..
I know only that Graphics32 component is thread-safe.
What about TBitmap, TJpegImage?
Which operation with this classes I should "Lock", should I lock?
Could the memory leak occur because of using these components?
How Can i fix my code?
Thanks for help in advance..