Qbasicnews.com
April 22, 2018, 07:39:09 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: memory/data errors  (Read 4523 times)
tox_von
New Member

Posts: 8


« on: April 19, 2010, 10:21:06 AM »

I've been getting out of data space and out of memory errors.

The second time i run my program i get these.

Is there any way to clear the memory when the program starts. i searched the tutorials for this but couldn't find anything.(or is there any other way to get rid of these.)
Logged
Clippy
Member
*
Posts: 84



« Reply #1 on: April 19, 2010, 02:32:32 PM »

Use RESTORE to read DATA again. You cannot read beyond the end of DATA!

Memory errors could come from too large arrays to too large of a program. Try breaking the program up into SUB programs.
Logged

tox_von
New Member

Posts: 8


« Reply #2 on: April 23, 2010, 09:56:15 AM »

i thought i fixed this when i found the CLEAR statement it worked at first.
Then i started doing more dim shared stuff and it returned is there a limit to how much there can be here?
if i dim shared stuff in subs could this work?
Logged
kinem
New Member

Posts: 2


« Reply #3 on: April 27, 2010, 02:58:21 PM »

Try the /ah command line option and use dynamic arrays (redim) if you haven't already.

It may be time for you to move on up to QB64 or Freebasic.
Logged
Clippy
Member
*
Posts: 84



« Reply #4 on: May 05, 2010, 03:41:26 PM »

Clear does NOT restore the DATA! If you have several DATA fields you can name them andv RESTORE the ones you need.

To name a DATA field use a line label:

MyData1:

DATA ,,,,,,,,,,
DATA ,,,,,,,,,,,
DATA ,,,,,,,,,,

When you READ the DATA you can restore that data field only:


RESTORE MyData

FOR i = 1 TO 20  'read 40 values using 2 variables
READ nam$, age%, address$
NEXT

I advise placing all DATA fields after the main program code has ended. That way, you don't accidentally go to the wrong DATA fields.
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!