Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not Enough Memory To Complete This Task

Status
Not open for further replies.

iamdon

Programmer
Dec 19, 2001
28
US
Hi Everyone,

This is a real mystery.

VFP 6.0 SP5 OS = XP Pro 256 Meg Memory Plenty of disk space. Running an EXE
HP LaserJet 9000dn printers 64 Meg of Memory in each.

Error 'not enough memory to complete this task'
No hint as to who/what is issuing the message as there is no caption on the window.
At the same time - Screen goes totally bonkers and the only thing left is task manager to exit the program.

Printing usually 15,000 to 20,000 pages at a time.
These are banking statements.
Header File - Detail File joined by SQL Select and printed from the resulting cursor.
Statement can be 2 to (have had as high as) 57 pages.

3 report forms --- Page1 Page2 PageNDuplexed
All the Report Forms contain the appropriate commands for the printer in the Expr field. Page2 and PageNDuplexed
are exactly the same report form with the only difference being the commands in the Expr field to duplex.

We know what belongs to each page and the total number of pages to be printed. (nNumPages)
The following are wrapped in a CASE statement that looks at the total number of pages and issues the
appropriate printing commands.

Page 1 needs to be printed from tray 2 and is printed on a pre-printed form.
Page 2 -> n needs be printed from tray 3 and is printed on plain paper.
Page 1 is totally different in format from the other pages -- name and address and the like plus some detail.

CASE nNumPages = 2
Report Form Page1 to print for page_is = 1
Report Form Page2 to print for page_is = 2

CASE nNumPages >2 .and. MOD(nNumPages,2) > 0 && Odd Number of Pages
Report Form Page1 to print for page_is = 1
Report Form PageNDuplexed to print for page_is > 1

CASE nNumPages >2 .and. MOD(nNumPages,2) = 0 && Even Number of Pages
Report Form Page1 to print for page_is = 1
Report Form PageNDuplexed to print for page_is > 1 .and. page_is <= nNumPages -1
Report Form Page2 to print for page_is = nNumPages

The whole thing blows up when you reach 4000 to 4500 pages printed.

Does anyone have any idea what could be going on here and point me in a direction to start looking for what could be
causing this huge memory leak?

Thanks So Much In Advance

Don Wobig

 
Don,
First, 256MB is what I'd consider minimal on XP when running a VFP application - especially if ANY other applications are loaded. Second, I've seen a single page take a MB or more of space in the spooler file, and 20,000 pages could require 20+GB! Do you have this much free diskspace? Also, the spooler would require a lot of memory to keep track of all this data, so you may really need more memory!

Rick
 
Thanks Rick,
Couple of things.
1) We print directly to the printer - no Spooling.
That is necessary as the spooler will not respect the collation of each statement. Sometimes it will print all page 1's and then a bunch of page 2's and the like. We have tried all kinds of settings and this always is the case.
2) If you watch the memory being consumed in the task manager, it is being gobbled in little chunks - hence the 4000 + pages before it blows. On one machine with only 128 Meg of memory -- the same thing happens and it happens in the same time frame (4000 + pages)

Very Very wierd.

Don

PS more thoughts are more than welcome!
 
XP may still be spooling. NT and XP both more or less took total control of any hardware. So even if your are printing directly to the port, it is still getting intercepted. Maybe you could try an earlier version of the printer driver. I suspect there are some fairly sizeable memory leaks there.
Dave S.
 
Thanks Dave,
Have tried the HP 8100 Driver ( we used to use those printers ) Didn't make any difference.
We are researching use of the drivers that come with XP to see if any of them will allow us to do what we have to do in terms of specifying bin paper type and the like. When the preprinted bin runs out - it needs to stop the printer and get refilled as opposed to just moving to the other bin which may still have paper in it.

Don
 
iamdon,

My first guess after reading your initial post was the spooling but you addressed that, now I'm thinking something else. What is the print processor and datatype you are using for the printer? Slighthaze = NULL
 
Hi, and thanks to you too.

WinPrint and RAW

Don
 
I can't remember if this function is used to decrease rather than increase RAM allocation, but could you use the SYS(3050) function to allocate more RAM to VFP?

Neil &quot;I like work. It fascinates me. I can sit and look at it for hours...&quot;
 
Could you (depending on how your print process is written) count how many pages have been sent to the printer and then introduce, say, a 10 - 20 second pause after 2500 pages in order for the spooler to dump its contents?

Also back to the SYS(3050) function, the Hacker's Guide to 6 says:

&quot;FoxPro loves memory—it always has. All other things being equal, FoxPro wants to grab as much memory as it can get. In Windows, that's not always a very nice thing to do. FoxPro 2.x for Windows included the MemLimit setting in the Config.FPW file to put a limit on FoxPro's appetite for memory. MemLimit doesn't do a thing in VFP, but SYS(3050) takes its place. Use it to cap the amount of memory Visual FoxPro can grab (or to let it have more than the default, if you know you won't be running other apps.) Our friend Mac Rubel has spent a lot of time testing VFP's behavior with different amounts of memory. His conclusion is that allocating too much memory can slow things down more than allocating not enough, so watch out with these settings.&quot;

...so you may need to decrease VFP RAM allocation so there's more for system processes.

Neil &quot;I like work. It fascinates me. I can sit and look at it for hours...&quot;
 
Hi Neil,
Sys(3050,1) indicates 358,350,848 bytes
Sys(3050,2) indicates 89,653,248 bytes

I guess this begs the question -
When the method of the form calls the report form, is the application running in the foreground or background?
I have no other apps running during the running of this program so I have to believe that it is in the foreground.
As such, wouldn't one guess the the amount of memory allocated to VFP is more than enough?

Don
 
Neil,
For info sake, I know there isn't anything but one print job in the printer que. (you can see it in the printer info box) and ... there is never more than 2 or 3 statements of normal length (3 to 5 pages) in the printer if you terminate the print job (outside of the uglies we are discussing here)for any reason. There will be nothing in the printer diaglog box and it will just print those couple statements. Also my program shows the name of the person whose statement we are printing - that is never more than 3 ahead of what comes out of the printer.

Part 2: Maybe I should cut down on the memory from the default shown in SYS(3050) That is worth a try!

Thanks so much
Don
 
Carl,
You are correct. You have seen this in your forum.
and I too believe it is the driver.

Just do not know how to rectify.

Thanks 2X
Don
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top