Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, June 26, 2007 6:36:22 AM(UTC)
jstewart

Groups: Registered
Posts: 12


We are creating an application to load and display many large TIFF files (can be bigger than 2000x52000 px). They are usually 1 bit black and white images. I am loading them and placing all the images into one BITMAPHANDLE and using L_PaintDC to paint it to the HDC (in my case a PaintBox). It works great until I try to make it very large (ie if they were to zoom in). It still works but can take up to a gig of RAM. Through some testing I found that it is not the bitmaphandle that is taking the space, it's the device context. The memory is not increased until I do an L_CreateDC or an L_PaintDC.

I noticed in some of the demos that you can zoom way in creating a very large scrolling window and still using very minimal memory. I've looked through the demo code and have not been able to see how it is done. Any help would be great!

JS
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, June 26, 2007 11:10:06 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


That is odd behavior; I've not encountered this before.  If you are loading an image into a BITMAPHANDLE with something like L_LoadBitmap, the memory should get allocated. 

A 2000x52000 1bpp image isn't that large, just around 13MB in memory.  Perhaps you are loading them at 24bpp inadvertently?

Either way, I'm not sure why L_CreateLeadDC or L_PaintDC would cause a memory peak while loading the image would not.  Please post a small sample project (NOT your entire application) that isolates this problem so I can try to reproduce it here.

NOTE: If you are attaching a project or file to the forums...
1.) Zip the file(s) up.
2.) Make sure it is less than 10 MB.  If it is larger, please send an email to support@leadtools.com or  give us your email address and we'll send you FTP instructions.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.
 
If you do not wish to post your file(s) on the forum since they are publically viewable, please send an email to support@leadtools.com and make sure that you include a link to this forum post.

 
#3 Posted : Wednesday, June 27, 2007 5:47:41 AM(UTC)
jstewart

Groups: Registered
Posts: 12


Here is a small sample project. I chose those size dimensions because there was a very noticeable spike when creating a DC or painting a DC. I use Borland C++ 2006 and just use debug mode to step through and test the memory usage at different points.

My goal is to find a way to display the main bitmaphandle to the screen efficiently. For example in the zoom view demo you can zoom way in and have full access to scrolling and still be using less than 100 MB.

I hope this makes sense. Thanks for any input!

JS
File Attachment(s):
TestProject.zip (1,918kb) downloaded 19 time(s).
 
#4 Posted : Wednesday, June 27, 2007 8:02:30 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


Everything seemed to be working fine for me according to your code.

The reason your project is allocating around 270 MB is because you are telling it to in your call to L_CreateBitmap (it just doesn't get allocated until you call L_CreateLeadDC).  A 24bpp image that is  4382 x 19653 is going to be right around 258MB.  Your 1bpp image that you are loading is only going to be about 12MB.  If you want to use less memory, then you need to use smaller images or lower bpps.
 
#5 Posted : Wednesday, June 27, 2007 9:10:36 AM(UTC)
jstewart

Groups: Registered
Posts: 12


Okay, thanks for the response. I starting thinking about it and thought that might be the case. Sorry for the dumb problem! Thanks again for the help.

JS
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.185 seconds.