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

OUT OF MEMORY / STRING SPACE?

Status
Not open for further replies.

qbasicking

Programmer
Aug 19, 2001
628
US
Everytime I edit my program I either get an OUT OF MEMORY or an OUT OF STRING SPACE error.

When I get OUT OF MEMORY, it deletes lines from my program, and I have to reopen it to avoid loosing them. I have a brand new computer. 1/2 a gig of RAM and the pif is set to auto.

When I get an OUT OF STRING SPACE error, i goto the top of the program hit Enter and then Backspace and it lets me run it.

How do I stop it from doing this. I am already using /AH and '$DYNAMIC
 
One of the most diffucult things to work around in QuickBasic programming are the memory limitations.

To create a great qb program requires that you have a constant awareness of the amount of memory you are accessing through the entire development of your applications. In fact, if you have to use the $DYNAMIC metacommand at all, that should be a message to you that it's time to reduce the size and memory usage of your program.

There is not a way to get past the QB memory limits when it comes to arrays, or program size, but by using an external library - like the Future.Lib - you can reduce the size of arrays you use for graphical functions, if not get rid of them.
 
I remember having this problem when my program was really big. Even though you have extra memory with AH I think the size of your program is still limited to 64k or somthing, not sure. I also think string space is different from available memory. I think 15k or so is the limit. Sounds like you're pretty sure it's not a run-away loop. Sorry I don't have any concrete info.
 
AOL messed up on me and gave me a connection timeout every time I tryed to send a message... Sorry about the whole tripple message thing... It won't happen again.
 
I've been able to make an app that used 87k BAS file before... But that may just be the size of a text BAS file vs. a binary BAS file.
 
On one of your last posts, you stated that when you tried to run your program, you got a "OUT OF STRING SPACE" error, but that it was fixed just by closing QB then Restarting it.

What you were seeing was that your program was so big, small things qb was storing (the current page in the help file, text in the Find dialog, watches) were enough to push QB's memory usage over the edge.

When you restarted QB, these little bits of text were cleared - just enough for your program to run/compile.
 
If you are using qb1.1 upgrade, as it has a bug that does this.
 
Two solutions to the lack of memory in the IDE:
-Remember to ERASE all dynamic arrays at program end. This leaves more place to the IDE.
-Remember to save regularly when editing.
-Put your already tested subs in a separate module, make it a qlb and load it as a qlb when starting QB. It saves A LOT of place.
-Use a program editor as MED. and a batch file to call bc, link and run the program. Antoni
 
If you want to do any serious memory intensive programming, then use XMS.
I'm writting the kernel for an OS in qbasic 7.1 at the moment, and I have to write functionsfor everything - even the print command!
One of the libraries I wrote is call 'mman', momoery manager.
It gives me commands like 'aloc_str' and 'retr_str'
if I was using a very long string, ie. 800,000 chars (in my incryption code, it uses strings of over 100000000 chars!) I would use this qbasic code.

CALL DynamicStringReserve 'reserve memory
DO WHILE INKEY$ <> CHR$(13)
temp$ = INKEY$
CALL FarAlloc (FarPointer + atf(temp$))
LOOP

This will make a string in the far memory section of the dos heap, which I can just pull off as i need it, using the

GetFarString (100)

command.

This will get the firts 100 characters from the heap, and clear them, so they wont exist on the heap anymore.

It's kinda sweet.

Play with XMS!!!!!!!!!!!!1





 
That's great, but while your program can access high memory, the source code itself still has to contend with the memory limits.
 
Hey, if your writing an OS, make a post in the &quot;Who wants to talk QB GUI?&quot; thread, and tell us a bit about it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top