|
Author |
Topic  |
|
Flashcqxg
12 Posts |
Posted - Jan 13 2021 : 03:08:48
|
My code is as follows:
for I := 0 to ImageEnMView.ImageCount - 1 do
begin
try
ImageEnMView.GetBitmap(I);
finally
ImageEnMView.ReleaseBitmap(I, False);
end;
end;
There are 120 pictures in ImageEnMView, each picture is about 80kb.When this program is executed for the first time, the program occupies about 30M of memory. After the second time, each execution occupies a maximum of about 1.2G of memory. Is this normal? Thanks. |
|
xequte
    
5759 Posts |
Posted - Jan 13 2021 : 19:15:38
|
Hi
GetBitmap converts the internal storage of images to TBitmap, which has poor memory handling.
You are better to use TImageEnMView1.GetTIEBitmap. If you need a TBitmap use TIEBitmap.CopyToTBitmap to copy the result to your bitmap.
const
USE_GETBITMAP = False;
var
I: Integer;
bmp: TBitmap;
iebmp: TIEBitmap;
begin
for I := 0 to ImageEnMView1.ImageCount - 1 do
begin
bmp := nil;
try
Caption := IntToStr( i ) + ' - ' + ImageEnMView1.ImageFilename[i];
if USE_GETBITMAP then
bmp := ImageEnMView1.GetBitmap(I)
else
begin
bmp := TBitmap.Create;
iebmp := ImageEnMView1.GetTIEBitmap(I);
iebmp.CopyToTBitmap( bmp );
end;
// do somethign with bmp...
finally
if not USE_GETBITMAP then
FreeAndNil( bmp );
ImageEnMView1.ReleaseBitmap(I, False);
end;
end;
MessageBeep(0);
end;
Nigel Xequte Software www.imageen.com
|
 |
|
Flashcqxg
12 Posts |
Posted - Jan 14 2021 : 03:30:24
|
Hello xequte,i have test the code,but same. After the second time, each execution occupies a maximum of about 1.2G of memory. |
 |
|
xequte
    
5759 Posts |
Posted - Jan 14 2021 : 20:57:44
|
Hi
The process above will load all images (if they were not previously loaded) into the TImageEnMView. Storage will be based on StoreType:
https://www.imageen.com/help/TImageEnMView.StoreType.html
So if StoreType is ietNormal, for instance, and images were loaded on demand (so not all initially loaded) then your code above will force the loading of all the images into memory. After the process completes they would remain in memory.
That doesn't explain why it wouldn't happen the first time though, so I suspect something else is going on. Can you email me a small demo project that shows the issue.
Nigel Xequte Software www.imageen.com
|
 |
|
Flashcqxg
12 Posts |
Posted - Jan 14 2021 : 21:30:30
|
Hi I have emailed the demo. |
 |
|
xequte
    
5759 Posts |
Posted - Jan 14 2021 : 21:56:40
|
Thanks, I can reproduce the issue and we are investigating.
Nigel Xequte Software www.imageen.com
|
 |
|
|
Topic  |
|
|
|
| |