×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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

(OP)
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

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

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."

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

(OP)
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

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

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
        RUN "Prog2.exe"
    CASE IS = 3
        RUN "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
        RUN "Prog1.exe"
    CASE IS = 3
        RUN "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
        RUN "Prog1.exe"
    CASE IS = 2
        RUN "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."

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

(OP)
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!

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

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."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close