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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting "Out Of Memory" Error when running an program by SHELL 1

Status
Not open for further replies.

aliinal

Technical User
Jun 26, 2001
104
TR
Hi everyone;

I've written a program in QBasic 7.1.
It uses several exe files itself. The main menu.exe calls other exe's. 1 calls a.exe 2 colls b.exe etc. etc.
but after approximately 8 calls system gives the error "Out of memory" and halts.
But after the error i may again run the program and no problem then till again approximately 8 calls.

If u can help me i'l be very happy. If you think that i can't explain enough i may tell again.
10q everyone
 
aliinal:

if you have the original source codes, you should try tracing your program when it reaches that 8th call you mentioned. (See DEBUG > TRACE ON or place a break and press F8 to step through each line of the program. You can press F5 to continue any time)

Also, on that 8th program's code (if you have the source) is place a line such as FRE(-2) to see how much room you still have available..(See help files for the FRE command).

Good Luck.
--MiggyD "The world shrinks more and more with every new user online."
 
I think i couldn't explain the situation well (cus of my terrible english)
My main menu program is cmenu.exe (whole code is written by me so i can make any changes that can help me)
when u run cmenu.exe program lists the sections that you can go like
1- Section A
2- Section B
3- ........
4- ......

when you hit the section number (1 to 4 here) it calls another exe (sectiona.exe, sectionb.exe etc.etc. and these programs are written by me so no problem about soruce code)
after running sectiona.exe if you want to return to main menu it runs cmenu.exe (SHELL "cmenu.exe") again you're on the main menu again.
In this procedure the error occures sometime when you're going to sections (running sectiona.exe sectionb.exe) or while returning to the cmenu.exe (SHELL "cmenu.exe")...
Systems says "OUT OF MEMORY ERROR IN MODULE CMENU AT ADDRESS XXXXXX Hit any key to return to system." After this mesage i hit any key and return to system and run the program manually by typing cmenu.exe or sectionb.exe...
and it runs in this case. but after passing between programs approxiamtely 8 times (sometimes 4 or 3) it gives the same error...
MiggyD thanks for your interest and if u can help me again i'll be pleasent. If you want i may send you all the source code (But it's all in turkish but nothing changes BASIC has the sam lang :))
Thank you again
 
OH! I see. I believe your problem is that you are using the SHELL command. You should try using the RUN command instead.

Copy the following code, there are 3 sections. Each section is a self contained program. Compile each section seperately and name the EXE file "Prog(x)"...where (x) is the section number like so:

PROG1.EXE, PROG2.EXE, and PROG3.EXE

Also, make sure that the new programs are ALL in the same directory so that they can run off each other.

'Example follows:

'---Start copying here


'-program #1
BeginAgain:
CLS
PRINT TAB(10); "HI! This is Program #1."
PRINT
PRINT "Press 2 for Program #2."
PRINT "Press 3 for Program #3."
PRINT
PRINT "Press 0 (or Return) to END all program(s)."
INPUT "", PrgToStart
SELECT CASE PrgToStart
CASE IS = 2
[red]RUN[/red] "Prog2.exe"
CASE IS = 3
[red]RUN[/red] "Prog3.exe"
CASE IS = 0
PRINT
PRINT "Ending all programs from #1..bye bye"
END
CASE ELSE
GOTO BeginAgain
END SELECT


'-program #2
BeginAgain:
CLS
PRINT TAB(10); "You've jumped to Program #2."
PRINT
PRINT "Press 1 for Program #1."
PRINT "Press 3 for Program #3."
PRINT
PRINT "Press 0 (or Return) to END all program(s)."
INPUT "", PrgToStart
SELECT CASE PrgToStart
CASE IS = 1
[red]RUN[/red] "Prog1.exe"
CASE IS = 3
[red]RUN[/red] "Prog3.exe"
CASE IS = 0
PRINT
PRINT "Ending all programs from #2..bye bye"
END
CASE ELSE
GOTO BeginAgain
END SELECT


'-program #3
BeginAgain:
CLS
PRINT TAB(10); "Welcome to Program #3."
PRINT
PRINT "Press 1 for Program #1."
PRINT "Press 2 for Program #2."
PRINT
PRINT "Press 0 (or Return) to END all program(s)."
INPUT "", PrgToStart
SELECT CASE PrgToStart
CASE IS = 1
[red]RUN[/red] "Prog1.exe"
CASE IS = 2
[red]RUN[/red] "Prog2.exe"
CASE IS = 0
PRINT
PRINT "Ending all programs from #3..bye bye"
END
CASE ELSE
GOTO BeginAgain
END SELECT

'---end of copy

Hope this helps.
--MiggyD "The world shrinks more and more with every new user online."
 
MiggyD you're incredible!!!!

Both of your tips worked.
No out of memory errors or out of stack space errors any more...

And RUN is working faster yhan SHELL :)) (Without errors of course...)

Thank you very much for your help!
 
Your welcome. But, I'm not incredible (although my wife says I am ;-) ) these are just some of the functions that are overlooked, that's all.


--MiggyD "The world shrinks more and more with every new user online."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top