Memory leak when printing report from VB

J

JES100

I have a system that sends 1 rec of data to access once an hour and once a day using ODBC.
The system also prints a report once an hour and day using VB script (DoCmd.OpenReport).
The system locks up about every 5 days so I ran the performance monitor and discovered that it runs out of memory.
Every hour when the report prints, a small chunk of memory is lost. I went thru my code and all my objects are destroyed (set to Nothing). I commented out the one line that does the printing (OpenReport command) and everything worked fine. no memory lost. Anybody know why the OpenReport command may be eating memory? Is ther another way to print Access reports through VB?
 
S

Suzette

Are you closing the report after opening it? It's just a thought.

JES100 said:
I have a system that sends 1 rec of data to access once an hour and once a day using ODBC.
The system also prints a report once an hour and day using VB script (DoCmd.OpenReport).
The system locks up about every 5 days so I ran the performance monitor
and discovered that it runs out of memory.
Every hour when the report prints, a small chunk of memory is lost. I went
thru my code and all my objects are destroyed (set to Nothing). I commented
out the one line that does the printing (OpenReport command) and everything
worked fine. no memory lost. Anybody know why the OpenReport command may be
eating memory? Is ther another way to print Access reports through VB?
 
R

rainerschulz

Hi, I have nearly the same problem.

With every Printout I loose about 80 KB of Memory. I use Access 97.

Do you have a "simple" Access Report? Because I have also some heav
VB-Code within my Report (to format it and so on....).

I have Service Pack 2b installed.

May be we can work a little bit togehter, to fix this problem.

Also my pc crashes after a couple of days.
If discovered so far, that access97/windows allocates memory i
irregular steps:
1 MB
2 MB ==> 3 MB TOTAL
4 MB ==> 7 MB TOTAL
64 MB ==> 71 MB TOTAL (High Chance of first crash!)
8 MB ==> 79 MB TOTAL
????

I used the GlobalMemoryStatus Method of the kernel32 to get thi
information....
My Performance-Monitor results, was unaccaptable, because I did not ge
it to the point, to record really the Memory-Affect.

Additionally Access97 does only check for PHYSICAL Memory (which i
quite unusual).

Additionally, a quite similar problem is known with forms i
Access2000:
http://tinyurl.com/yqlkp

Raine


-
rainerschul
 
R

rainerschulz

Hey, I did find the reason (sorry for my broken english - I am Germa
and quality depends on the local time. Late at night it gets worse an
worse..).

The reason has NOTHING to do with access (not directly). It was th
printer driver.

I did use leadTools eprint to generate the PDF-Files.
Already in the preview, it did take about 2 kB per Page.

Thats it. Different selected printer, no problem.

Raine


-
rainerschul
 
T

Tony Toews

rainerschulz said:
With every Printout I loose about 80 KB of Memory. I use Access 97.

Stephen Lebans recently informed us that using the OnPrint event
rather than the OnFormat event has been suggested by Microsoft's tech
support to alleviate running out of memory or system resources when
printing images.

Stephen Lebans has stated that Microsoft has determined that the
long-time problem of leaking memory in reports using image controls
does not occur if the image files are .BMP.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

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