[net.micro.amiga] MEMORY MANAGEMENT AND AMIGABASIC

jwhitman@ALMSA-1.ARPA@caip.RUTGERS.EDU (02/10/86)

From: Jerry Whitman <jwhitman@ALMSA-1.ARPA>


1.	Glad to see that I am not the only one with *dumb* questions.  We are 
relatively new AMIGA owners at the home owner/user level.  As yet we have not 
been able to acquire the necessary tech manuals so these questions may seem
trivial to those who have access to them.

2.	Additional handicap - We have only 256k.  Obviously 512 is needed to
utilize much of the potential of the AMIGA and we will upgrade as budget 
permits.

3.	The first problem encountered is with AmigaBASIC (MicroSoft V1.1) and
its memory management.  Opening Basic by double ckicking it from the Extras
disk yields two messages in the immediate window. 1 - 40xxx bytes storage
available to system, and 2 - 14xxx bytes available to Basic.  Using the clear
command I can re-allocate the 14k between the Basic Data and the Basic Stack.
However I do not find any way to re-allocate more of the 40k to Basic.  Am I
missisng something fundamental here??

4.	The second problem stems from trying to cure the first.  I edited the
Startup-Sequence to preclude loading of Workbench, leaving the system under
DOS.  My hope was that without Workbench, Basic would grab a major portion of
the additional unused core.  Trying to load Basic directly under DOS resulted
in much thrashing that culminated in the dreaded *Red Box* with the message
OUT OF HEAP SPACE -PRESS LEFT MOUSE BUTTON TO CONTINUE.  This promptly returned
to DOS.  When Workbench is loaded and a CLI window opened I can load Basic just
fine, albeit it has only 13k of system storage available.  What does Workbench
do th manage the HEAP allocation and how can I duplicate it or get around it??

5.	Can someone clarify the use of the terms STACK, HEAP, and PILE?  Every
time I think I understand the distinctions I read something that un-clarifies
it for me.

6.	if any of these problems are the result of my stupidity don't feel too
bad about pointing it out.  I have not seen evidence of many faint-hearted
members on this BB.

7.	Reply to JWHITMAN@ALMSA-1.ARPA.

			Thanks for your indulgence.....
			Jerry

jwhitman@ALMSA-1.ARPA (03/09/86)

From: Jerry Whitman <jwhitman@ALMSA-1.ARPA>


The following is a re-send of my earlier cry for help.  I received two replies
suggesting use of the STACK command prior to loading AmigaBASIC.  Tried both 
of those and got same result *OUT OF HEAP SPACE*.

There appears to be a tendancy of the members of this BBS to ignore questions
from the non-proficient user.  I certainly hope this is a mis-conception on
my part as I do not think any of the experts got to be experts with out some
one helping them when they were less than proficient.

<1.	Glad to see that I am not the only one with *dumb* questions.  We are 
<relatively new AMIGA owners at the home owner/user level.  As yet we have not 
<been able to acquire the necessary tech manuals so these questions may seem
<trivial to those who have access to them.
<
<2.	Additional handicap - We have only 256k.  Obviously 512 is needed to
<utilize much of the potential of the AMIGA and we will upgrade as budget 
<permits.
<
<3.	The first problem encountered is with AmigaBASIC (MicroSoft V1.1) and
<its memory management.  Opening Basic by double clicking it from the Extras
<disk yields two messages in the immediate window. 1 - 40xxx bytes storage
<available to system, and 2 - 14xxx bytes available to Basic.  Using the clear
<command I can re-allocate the 14k between the Basic Data and the Basic Stack.
<However I do not find any way to re-allocate more of the 40k to Basic.  Am I
<missing something fundamental here??
<
<4.	The second problem stems from trying to cure the first.  I edited the
<Startup-Sequence to preclude loading of Workbench, leaving the system under
<DOS.  My hope was that without Workbench, Basic would grab a major portion of
<the additional unused core.  Trying to load Basic directly under DOS resulted
<in much thrashing that culminated in the dreaded *Red Box* with the message
<OUT OF HEAP SPACE -PRESS LEFT MOUSE BUTTON TO CONTINUE.  This promptly returned
<to DOS.  When Workbench is loaded and a CLI window opened I can load Basic just
<fine, albeit it has only 13k of system storage available.  What does Workbench
<do to manage the HEAP allocation and how can I duplicate it or get around it??
<
<5.	Can someone clarify the use of the terms STACK, HEAP, and PILE?  Every
<time I think I understand the distinctions I read something that un-clarifies
<it for me.
<
<6.	If any of these problems are the result of my stupidity don't feel too
<bad about pointing it out.  I have not seen evidence of many faint-hearted
<members on this BB.

7.	Reply to JWHITMAN@ALMSA-1.ARPA.

			Thanks for your indulgence.....
			Jerry

bruceb@amiga.UUCP (Bruce Barrett) (03/12/86)

In article <1476@caip.RUTGERS.EDU> jwhitman@ALMSA-1.ARPA writes:
>From: Jerry Whitman <jwhitman@ALMSA-1.ARPA>
>
>  [ ...problems w 256k Amiga and AmigaBasic... ]
>3.	The first problem encountered is with AmigaBASIC (MicroSoft V1.1) and
>its memory management.  Opening Basic by double clicking it from the Extras
>disk yields two messages in the immediate window. 1 - 40xxx bytes storage
>available to system, and 2 - 14xxx bytes available to Basic.  Using the 
>clear
>command I can re-allocate the 14k between the Basic Data and the Basic Stack.
>However I do not find any way to re-allocate more of the 40k to Basic.  Am I
>missing something fundamental here??
>
I looks to me as though AmigaBASIC wants to allocate 2 contigious spaces
for its stack and data areas.  The CLEAR command seems to 1) Grab the memeory
you requested from the system, 2) Copies source code into the new copy,
3) releases the original area.  For this reason, if you try to go from a 
medium size region to a large one you can get an out of memory error even 
though there "should be" enough memory in the system.

To "maximize" available memory:
	1) disconnect 2nd frive (if present)
	2) drag basic icon out of window
	3) close window, open basic
	4) close List window
	5) make the BASIC window very small
	6) type clear,1024,1024 (maybe twice will help)
	7) print fre(-1) (I get about 60104)
	8) clear ,35000 (aproximatly)


The problem or running AmigaBASIC in a 256k machine from the CLI is known.
There is no known solution, you must run it from workbench or from a CLI
under Workbench.  Further I do not have an explanation for this.

>
>5.	Can someone clarify the use of the terms STACK, HEAP, and PILE?  Every
>time I think I understand the distinctions I read something that un-clarifies
>it for me.

As I understand it, the 3 values for the AmigaBasic CLEAR command are:
	<val1> Unused, must be < 32k (figure that one out)
	<val2> Space for basic source code, variables, file blocks.
	<val3> "system stack" (I'm not sure, may be used to pass
	parameters to Amiga routines, to user subroutines,...

--Good luck.
--Bruce Barrett