how to resolve memory hogging?

E

edward

I have a db with links to images. Because the images are large, I don't
use OLE Objects but rather the technique described at
http://support.microsoft.com/kb/148463/ which is to store the image
path in a text field, put an image frame on the form/report, and use an
event procedure to assign the path field to the picture attribute of
the image control before display/format. For example, in a report using
this image link, I have a Format event procedure which does

Me![Imageframe].picture = me![Imagepath]

Functionally this works. My problems are coming when I try to print
more than the first page or two. I should note that the images are
moderate sized photos and scans, ranging from 1.5MB JPGs to 25MB PNGs.

Access uses humongous amounts of memory to print, humongous even for
Access. I'm printing three records per page, one image in each. To
print the first page, the memory used by Access will from from 10MB to
200MB, then up to 400MB for two pages, then 550MB for three pages
(based on watching Task Manager). Beyond that it usually fails
completely, returning without printing anything after chugging for a
while, but I've also seen it oscillating wildly, going up to 500MB,
down to 8MB, up up up again, etc.. My database only has 33 records at
present, but so far I've been unable to print the last three pages at
all, and sometimes I am only able to print the first three pages.

The poor systems I tried this on only have 1GB of RAM. I suppose I need
to bump it up to a terabyte so Access will have enough ... oh, I
forgot, it's against Access' principles to think it has enough memory.
Sigh.

I set up the db on an XP machine with 1GB of RAM and A97, with the db
and the images on an external HD. Nothing much was running on this
machine, and that's where I got the best results (eight pages). To see
if it would make any difference, I moved it to a system which also has
1GB but has A2002 and lots of applications (about 20) running, and so
correspondingly less available memory. I was hoping that A2002 might
handle the situation better, but no luck, exactly the same results.

You'd think I'd be OK if I just printed one page at a time. But no: to
print page 11, Access has to Format pages 1-10 without printing them.
And this causes problems just like actual printing does.

In short, it looks to me like a classical memory leak and garbage
collection, and that at some point an actual allocation failure takes
place and the print aborts.

Any ideas on how to resolve this? Is there some function I can call at
some event to tell Access to garbage collect?

Edward
 
T

TerryC

Edward,

Not a lot of good news on this front. You may wish to "paramtarise" your
underlying query to print from record 1-5 then 6-10 etc. The other thing that
helps Access is to convert your images to bitmaps (Access will perform about
twice as well with bitmaps in my experience). Stephen Lebans has some good
stuff at his web site for converting images on the fly. www.lebans.com

I have heard that shifting the image path coding to the on print event works
and may be more efficient.(???)

I'd be interested to know how you get on and if there are some other tricks
to managing images in reports.

HTH

Terry


I have a db with links to images. Because the images are large, I don't
use OLE Objects but rather the technique described at
http://support.microsoft.com/kb/148463/ which is to store the image
path in a text field, put an image frame on the form/report, and use an
event procedure to assign the path field to the picture attribute of
the image control before display/format. For example, in a report using
this image link, I have a Format event procedure which does

Me![Imageframe].picture = me![Imagepath]

Functionally this works. My problems are coming when I try to print
more than the first page or two. I should note that the images are
moderate sized photos and scans, ranging from 1.5MB JPGs to 25MB PNGs.

Access uses humongous amounts of memory to print, humongous even for
Access. I'm printing three records per page, one image in each. To
print the first page, the memory used by Access will from from 10MB to
200MB, then up to 400MB for two pages, then 550MB for three pages
(based on watching Task Manager). Beyond that it usually fails
completely, returning without printing anything after chugging for a
while, but I've also seen it oscillating wildly, going up to 500MB,
down to 8MB, up up up again, etc.. My database only has 33 records at
present, but so far I've been unable to print the last three pages at
all, and sometimes I am only able to print the first three pages.

The poor systems I tried this on only have 1GB of RAM. I suppose I need
to bump it up to a terabyte so Access will have enough ... oh, I
forgot, it's against Access' principles to think it has enough memory.
Sigh.

I set up the db on an XP machine with 1GB of RAM and A97, with the db
and the images on an external HD. Nothing much was running on this
machine, and that's where I got the best results (eight pages). To see
if it would make any difference, I moved it to a system which also has
1GB but has A2002 and lots of applications (about 20) running, and so
correspondingly less available memory. I was hoping that A2002 might
handle the situation better, but no luck, exactly the same results.

You'd think I'd be OK if I just printed one page at a time. But no: to
print page 11, Access has to Format pages 1-10 without printing them.
And this causes problems just like actual printing does.

In short, it looks to me like a classical memory leak and garbage
collection, and that at some point an actual allocation failure takes
place and the print aborts.

Any ideas on how to resolve this? Is there some function I can call at
some event to tell Access to garbage collect?

Edward
 
E

edward

Hi Terry,

Thanks for prompting me to go back to Stephen's site -- I had looked
before but this time found the details you were probably alluding to,
about half way down the page at http://www.lebans.com/image_faq.htm.
I'm going to try some of that. I see that his code uses the On Print --
it's weird that this would work, based on the Access help, but maybe
that will help too.

I was actually working over the weekend on the other approach you
mention, changing the report so that it queries only the records for
one page, and printing one page at a time. So far it works for the
first page ... but that's another thread.

Edward
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top