[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

2245.0. "AmigaBASIC space constraints?" by WJG::GUINEAU () Wed Feb 15 1989 22:04

My roomate asked me to enter this.

He is writing an AmigaBASIC program that has gotten rather large. He say's
that now he wants to  add a few last features and when he add the extra lines,
the program won't run (out of memory error or something like that).

I know he's not running out of RAM since it does the same on my machine (2.5meg).

I haven't looked much but I figure it must be some internal allocation that
basic makes (variable space, stack space?).

Anyone seen this?

John
T.RTitleUserPersonal
Name
DateLines
2245.1wild guessGUCCI::HERBWed Feb 15 1989 23:207
    I have a 1 meg A500 and when I load up basic it says something like
    700000 bytes free in system,25000 bytes free in basic. Is 25000
    bytes all you can have in basic? Is his program more than 25000
    bytes?
    
    Matt
    
2245.2BAGELS::BRANNONDave BrannonWed Feb 15 1989 23:355
    It's been a long while since I tried it, but I believe if you
    look for the description of the CLEAR command you will see
    an option for telling basic how much memory it can use.
    
    -dave
2245.3GUCCI::HERBWed Feb 15 1989 23:464
    The Fre command tells you how much memory is availible.
    
    Matt
    
2245.4Maybe you need more stackVCSESU::MOORETom Moore MRO1-3/SL1 297-5224Thu Feb 16 1989 00:025
We had a program like that that we got out of Compute Magazine. You had to
start basic, ask for more stack or something like that and then load the
program. I'll look it up when I get a chance (if someone else doesn't beat me
to it). 
-Tom-
2245.5WJG::GUINEAUThu Feb 16 1989 10:4833
Tried stack out of Amiga experience. No luck.

Then remembered something about the CLEAR command. Sure enough:

AmigaBASIC has 3 memory areas it deals with:	

	STACK		- for gosubs etc..
	DATA SEGMENT	- For program and it's variables
	HEAP		- Shared with whole system

so
	CLEAR [,[data-segment-size][,heap]]

is the command to set these areas. 

The default is 25000 data segment bytes. Jeff's program was apparently
bigger than that when he started allocating variables. so 

		CLEAR ,30000

Fixed this.

		FRE(-1) 	returns remaining size of stack
		FRE(-2)		returns size of heap
		FRE(anything else) returns remaining size of data segment.


You can put CLEAR ,30000 as the first lin in a program (he did). Then use
the FRE() statement to keep tabs...


John