[comp.sys.amiga] Help! I can't seem to run a program > 2meg in my 4meg Amiga

jtw@lanl.UUCP (01/29/87)

Could someone please explain why an AMIGA with a 4 megabyte memory expansion
will only run tasks that total to 2 megabytes or less???

Recently I added an AMERISTAR expansion bus with two 2 megabyte memory boards
and a hard disk.  I am running the new Amiga 1.2 operating system with the
Absoft Fortran compiler.  AmigaDos 1.2 auto configures memory, and
automatically sees the 4 megabytes.  I can easily copy 4 megabytes of files
into the memory without any problems.  It appears part of the operating system
sees the 4 megabytes, but part does not.  To be exact, the part of the
operating system dictating memory available for running processes, appears
to be seeing only 2 megabytes!

To try to understand what is happening, I wrote a simple 10 line fortran
program and tried some experiments.  I dimensioned an array of 500,000
and wrote into it, without any problem.  This required 2 megabytes.
If I added another array of 50,000 words, this crashed the operating
system.  Since 4 megabytes are available, I tried running two smaller
programs concurrently, each requiring 1.6 megabytes.  Individually they
run fine, but together they crash the machine.

Getting down to the Amiga operating system - AvailMem sees 4 megabytes of FAST
memory, but if I ask AllocMem to allocate any memory block greater than 2
megabytes it crashes the machine.

Granted this is not a reasonable action, but if I ask AmigaDos to set the stack
(with the STACK command) to any number greater than 2 megabytes, it refuses -
even when the machine is empty and 4 megabytes are present.

I have spoken with the Absoft Fortran people, and they see no problem running
programs greater than 2 megabytes.  I have spoken with the expansion bus vendor
and they do not understand why there should be a problem. My knowledge and
understanding of the Amiga hardware and software is limited, but my guess is
AmigaDos 1.2 has a BUG and is not allowing processes to use more than 2
megabytes of memory - total.

I called Amiga in Pa, and was told to call Marketing Link in Colorado.
Marketing Link, said the question was too technical, call the Amiga
engineers in Calif.  The secretary for Amiga in Calif told me to
call Amiga in Pa for technical support!  Where is the support???

I WOULD VERY MUCH APPRECIATE SOME HELP - PLEASE.


Thanks,

Jim T. West
Group X-6
Los Alamos National Laboratory
Los Alamos, New Mexico

Phone: 505-667-5615 (work)
       505-672-1592 (home)

Electronic Mail Address: JTW@LANL.ARPA

hadeishi@husc4.UUCP (01/30/87)

In <12032@lanl.ARPA> jtw@lanl.ARPA (James West) writes:
>Could someone please explain why an AMIGA with a 4 megabyte memory expansion
>will only run tasks that total to 2 megabytes or less???
>
>Recently I added an AMERISTAR expansion bus with two 2 megabyte memory boards
>and a hard disk.  I am running the new Amiga 1.2 operating system with the
>Absoft Fortran compiler.  AmigaDos 1.2 auto configures memory, and
>automatically sees the 4 megabytes.  I can easily copy 4 megabytes of files
>into the memory without any problems.  It appears part of the operating system
>sees the 4 megabytes, but part does not.  To be exact, the part of the
>operating system dictating memory available for running processes, appears
>to be seeing only 2 megabytes!
>
>To try to understand what is happening, I wrote a simple 10 line fortran
>program and tried some experiments.  I dimensioned an array of 500,000
>and wrote into it, without any problem.  This required 2 megabytes.
>If I added another array of 50,000 words, this crashed the operating
>system.  Since 4 megabytes are available, I tried running two smaller
>programs concurrently, each requiring 1.6 megabytes.  Individually they
>run fine, but together they crash the machine.
>
	One possibility is that the free list has two blocks of 2 megabyte
memory each.  So even though you have 4 megabytes, it is partitioned into
two blocks of 2 megabytes.  If this is the case then you would be able to
scatter-load a >2 Meg program (since the loader doesn't require the program
modules to be contiguous in memory) but you wouldn't be able to create
a continuous array >2 Meg.

	The fix for this would be somehow to tweak the free list at
startup to merge to two blocks of memory together.  However, it seems
to me the memory boards should be set up to autoconfigure into
contiguous regions.  Note: are you using a 68020 board?  Any
32-bit memory is automatically located way up there beyond the usual
16 Megabyte address space limit.  If one of those memory boards is
a 32-bit board, something is wrong.

	However, this would not explain why your machine crashed when you
tried to run two 1.6 meg programs, nor why your machine crashed when
you only ASKED for >2 Meg.  AllocMem should simply fail if you have
a fragmented address space and you ask for a contiguous area greater than
2 Meg.  This is either a bug in 1.2 AllocMem (very possible, since AllocMem
has been known to have had problems in earlier beta versions of 1.2)
or a problem with the autoconfiguration of your memory board which
leaves the free list corrupt.  If you check the GURU when you crash,
see if it is number 80000005 or 80000009; the first means free list
corrupt, the second means an attempt to free a block twice has occurred
(also due to a corrupt free list or possibly an errant program.)

>Getting down to the Amiga operating system - AvailMem sees 4 megabytes of FAST
>memory, but if I ask AllocMem to allocate any memory block greater than 2
>megabytes it crashes the machine.
>
>Granted this is not a reasonable action, but if I ask AmigaDos to set the stack
>(with the STACK command) to any number greater than 2 megabytes, it refuses -
>even when the machine is empty and 4 megabytes are present.
>
>I have spoken with the Absoft Fortran people, and they see no problem running
>programs greater than 2 megabytes.  I have spoken with the expansion bus vendor
>and they do not understand why there should be a problem. My knowledge and
>understanding of the Amiga hardware and software is limited, but my guess is
>AmigaDos 1.2 has a BUG and is not allowing processes to use more than 2
>megabytes of memory - total.
>
>I called Amiga in Pa, and was told to call Marketing Link in Colorado.
>Marketing Link, said the question was too technical, call the Amiga
>engineers in Calif.  The secretary for Amiga in Calif told me to
>call Amiga in Pa for technical support!  Where is the support???

	You want to call developer support in West Chester.  Hopefully
someone there will see this plea and give a more knowledgeable response.

	NOTE:  I seem to have had a problem with AllocMem() when
allocating small bits of memory and then freeing them.  After running
my program a few times, the free list gets corrupted.  When I
got rid of one of the tiny allocations, the program stopped corrupting
the free list, at least no guru after about ten trial runs.  The
allocation was a BitMap for a CUSTOMBITMAP Screen.  According to the
manual, I am supposed to be able to free the BitMap used in the
NewScreen structure after it is used.  Does Intuition do something
weird and try to free the BitMap itself?  This would make no sense
whatsoever, and I have enough faith in RJ and Jim to believe that
they wouldn't do such a thing.  Of course, these problems could
be due to the fact that I am using register variables in Lattice 3.10,
which is notoriously nasty with registers.  However my allocation
deallocation routines don't use too many registers (more than 3)
so I don't really know what the problem could be.

			-Mitsu
	

grr@cbmvax.UUCP (01/30/87)

In article <12032@lanl.ARPA> jtw@lanl.ARPA (James West) writes:
>Could someone please explain why an AMIGA with a 4 megabyte memory expansion
>will only run tasks that total to 2 megabytes or less???

Your question has been bouncing around Commodore all day, but no immediate
answer - we're thinking about it, but it sounds like some kind of problem
with the way the Ameristar is responding to to Autoconfigure.  Suggest for
now that you contact Ameristar and describe your problem - maybe send them
a diskette with your test program on it...

Sorry if you've been getting the run-around, but it's one of those questions
where everybody says "hmmm, that can't be my problem...".

Does Ameristar provide any kind of memory test?  The should be able to send
you something...
-- 
George Robbins - now working for,	uucp: {ihnp4|seismo|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr@seismo.css.GOV
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)

eric@topaz.UUCP (01/31/87)

The limitation you are encountering is imposed by the way the Amiga
configures memory boards. Given two 2Mbyte boards, there is a MemChunk
at 200000 Hex, and one at 400000 Hex. Because the MemChunk splits your
address space, you can never allocate a contiguous chunk larger than
the size of your largest memory board.

Perry Kivolowitz of ASDG has written a program to eliminate this
limitation, you can also eliminate it by getting one of his 8 Mbyte
memory boards (one board!). Send mail to well!perry for more info
about the program or his memory boards.

Eric
-- 
ARPA:	LAVITSKY@RUTGERS or LAVITSKY@RED.RUTGERS.EDU
UUCP:	...topaz!eric
	...hplabs!well!lavitsky
	...ulysses!eric

grr@cbmvax.UUCP (01/31/87)

In article <1126@husc6.UUCP> hadeishi@husc4.UUCP (mitsuharu hadeishi) writes:
>
>	NOTE:  I seem to have had a problem with AllocMem() when
>allocating small bits of memory and then freeing them.  After running
>my program a few times, the free list gets corrupted.  When I
>got rid of one of the tiny allocations, the program stopped corrupting
>the free list, at least no guru after about ten trial runs.
>			-Mitsu

Suggest you define the problem as clearly as possible and send something in
the form of a bug report towards cbmvax!{carolyn|phillip|andy}...
-- 
George Robbins - now working for,	uucp: {ihnp4|seismo|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr@seismo.css.GOV
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)

carolyn@cbmvax.UUCP (02/03/87)

In article <12032@lanl.ARPA> jtw@lanl.ARPA (James West) writes:
>Could someone please explain why an AMIGA with a 4 megabyte memory expansion
>will only run tasks that total to 2 megabytes or less???
>
>Recently I added an AMERISTAR expansion bus with two 2 megabyte memory boards
>and a hard disk.  I am running the new Amiga 1.2 operating system with the
>Absoft Fortran compiler.  AmigaDos 1.2 auto configures memory, and
>automatically sees the 4 megabytes.  I can easily copy 4 megabytes of files
>into the memory without any problems.  It appears part of the operating system
>sees the 4 megabytes, but part does not.  To be exact, the part of the
>operating system dictating memory available for running processes, appears
>to be seeing only 2 megabytes!
>...

   Separate memory boards (such as Jim's 2 2-meg boards) are configured
as separate entities, each with its own entry in the system MemList
and its own MemHeader in its first 32 bytes.

   Jim's programs apparently need a contiguous chunk of memory larger
than what is available in either individual board.  The following
program "MergeMem.c" attempts to merge the MemList entries of
sequentially configured ram boards.  I tested it with a 1/2 meg Alegra
plugged into the pass-thru of a 2-meg StarBoard.  It successfully
merged the MemList entries of these two boards.  After the merge,
I was able to AllocMem() a 2.1 megabyte chunk.

------------------------------------------------------------------------

/* MergeMem.c - by  Carolyn Scheppner  CBM  02/87
 *  Attempts to merge the memlists of sequentially configged ram boards
 *  which have the same Attributes (for contiguous expansion ram)
 *
 *  Note:  This program has been tested with an Alegra plugged into
 *         a Microbotics Starboard' pass-thru.  The program makes
 *         the assumption that sequentially configged ram boards
 *         have sequential entries in the MemHeader list.  If this
 *         is not always true, then this program may not work for
 *         some expansion configurations.  Works fine for me though.
 */

#include "exec/types.h"
#include "exec/exec.h" 
#include "exec/execbase.h" 

extern struct ExecBase *SysBase;

main()
   {
   struct MemChunk *chunk;
   struct MemHeader *mem, *firstmem, *prevmem = 0;
   struct ExecBase *eb = SysBase;
   ULONG  memsize;

   /* Temps */
   struct MemChunk *oldFirst;
   APTR   oldLower, oldUpper;
   ULONG  oldFree;

   Forbid();
   firstmem = (struct MemHeader *)eb->MemList.lh_Head;

   /* Go to end of MemHeader list */
   for (mem = firstmem;
           mem->mh_Node.ln_Succ;
              mem = (struct MemHeader *)mem->mh_Node.ln_Succ)
      printf("Found memory type $%lx at $%lx\n",mem->mh_Attributes,mem);

   /* Back up from terminal node to point at last MemHeader */
   mem = (struct MemHeader *)mem->mh_Node.ln_Pred;

   /* Backwards, for each except first */
   for ( ; (ULONG)mem != (ULONG)firstmem; mem = prevmem)
      {
      prevmem = (struct MemHeader *)mem->mh_Node.ln_Pred;

      /* If prev MemHeader describes neighboring ram of same Attributes */
      if(((ULONG)prevmem->mh_Upper == (ULONG)mem->mh_Lower - 32)&&
           (prevmem->mh_Attributes == mem->mh_Attributes))
         {
         printf("Merging $%lx with $%lx\n",prevmem,mem);
         /* Save needed stuff from MemHeader before Remove()ing it */
         oldFirst = mem->mh_First;
         oldLower = mem->mh_Lower;
         oldUpper = mem->mh_Upper;
         oldFree  = mem->mh_Free;
         Remove(mem);

         /* Adjust Upper and Free in prev MemHeader to include this mem */
         memsize = (ULONG)oldUpper - (ULONG)oldLower +32L;
         prevmem->mh_Upper = (APTR)((ULONG)prevmem->mh_Upper + memsize);
         prevmem->mh_Free += oldFree;

         /* Link last free chunk of prevmem to first free of mem */
         for (chunk = prevmem->mh_First;
                  chunk->mc_Next; chunk = chunk->mc_Next);
         chunk->mc_Next = oldFirst;

         /* Now FreeMem() the old MemHeader as a 32 byte chunk */
         FreeMem(mem,32);
         }
      }
   Permit();
   }

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=