ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnMView and Memory

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Flashcqxg 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.
9   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - May 31 2021 : 03:40:17
Hi

Can you please email me a DICOM file that reproduces this issue.


Nigel
Xequte Software
www.imageen.com
zhengyuanyi27 Posted - May 29 2021 : 22:49:26
Just to report a weard problem about "out of memory" and its solution method.
The following code (if saveimaggendialog1.Execute then Imageenmview1.IO.LoadFromFileDICOM(...);) will cause "out of memory" error when loading some DICOM file (It always works well before loading the DICOM file from the latest ultrasound machine of Philips company.)

The solution is very easy but it took me a lot of time to find it.
The solution is: Replace saveimaggendialog1.Execute with savedialog1.Execute, then it works well as before.
Flashcqxg Posted - Jan 18 2021 : 18:47:34
Thank you, now it works!
xequte Posted - Jan 18 2021 : 16:50:27
Thanks,

This behavior is due to the way images are cached, which after subsequent runs reaches a maximum of 100 cached images (by default), i.e. 1GB (each image is 1654x2339 = 11MB x 100 = 1100MB).

To reduce the memory footprint, you can set ImageEnmView1.ImageCacheSize to a smaller number like 10.

https://www.imageen.com/help/TImageEnMView.ImageCacheSize.html

Nigel
Xequte Software
www.imageen.com
xequte Posted - Jan 14 2021 : 21:56:40
Thanks, I can reproduce the issue and we are investigating.



Nigel
Xequte Software
www.imageen.com
Flashcqxg Posted - Jan 14 2021 : 21:30:30
Hi
I have emailed the demo.
xequte 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 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 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