Author |
Topic  |
|
ameza
Mexico
1 Posts |
Posted - Sep 01 2014 : 15:37:47
|
Is there a property to get file size of an image loaded into TImageEn? |
|
xequte
    
38962 Posts |
|
eramirezgz
Mexico
3 Posts |
Posted - May 07 2015 : 13:29:00
|
Hi, I found this question without an answer. I need to know the size in memory of the image.
I'm using a TImageEnView component to retrieve images from a database and when I load it, my application increases memory in 12MB (According to Task Manager).
Once loaded, I check the Bitmap width and height of the image and is: 1920 x 2560 = 4.69MB, I suppose this should be more or less the maximum memory it requires.
After I process the image i tried to release this memory, but haven't found the right command to do it (I tried with bitmap.freeimage, image.Clear, image.Free), actually bitmap.freeimage increases memory...
NOTE: I'm using ImageEn 5.1 |
 |
|
w2m
   
USA
1990 Posts |
Posted - May 07 2015 : 14:27:00
|
You should not have to free TImageEnView unless you create it at run time. When you free TImageEnView it also frees the memory in the bitmap.
If TImageEnView is added to a form at design time when you close the form, TImageEnView and any bitmap it holds is released. I do not see why you want to free it. Please explain how you are using the component. If it is created in the IDE at design time then you just open an image at runtime there is no need to free.
Using the TaskManager to monitor memory does not work very well. The memory in the TaskManager is for the whole application, all its its forms and all its components... not just the image in memory.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
 |
|
eramirezgz
Mexico
3 Posts |
Posted - May 07 2015 : 15:31:03
|
I agree with you about using TaskManager, that's the reason I want to check the memory required in the control.
this is the actual code:
oImagenStream := CreateBlobStream( FieldByName( sField ), bmRead ); oImageEnView.IO.LoadFromStream( oImagenStream ); FreeAndNil( oImagenStream );
debugging the code, before it gets to LoadFromStream() my app it's 27.1MB, exactly after this statement it gets up to 41.1MB and when the application processed 300+ images ends using 1.8GB
NOTE: The component it's added at desing time, but i already tried creating and destroying the control in the method and got the same result. |
 |
|
xequte
    
38962 Posts |
Posted - May 07 2015 : 18:58:32
|
Hi
It is not just the image that can take up memory. Some images contain meta data, which can often be huge (I recently saw images with >70MB of meta data).
But with a TImageEnView all memory from the previous image should be cleaned up when loading the next one.
So there may be a memory leak somewhere in the app.
Try monitoring for leaks by enabling ReportMemoryLeaksOnShutdown
Or using a memory tool:
http://stackoverflow.com/questions/416046/what-is-the-best-tool-to-detect-memory-leaks-in-delphi
If you think it is ImageEn related. Create a new demo that reproduces it (ideally without use of a database) and send it to us.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
|
Topic  |
|