[comp.sys.apollo] Dynamic memory in f77

ddawson@csd4.csd.uwm.edu (Daniel R Dawson) (06/06/91)

Howdy fellow HaPollo users!

    I'm wondering if anyone out there has found a way to achieve
    dynamic memory allocation in the Apollo bsd4.3 or sys5.3 UNIX
    fortran compiler (f77).  The touchy part is that I'd like
    a common block to be the dynamic memory involved.

	 What is done now:
	     Jack up the array size to some huge value and hope
	     you will never need more than this:

	     COMMON / MEMORY / DYNMIC(4000000)

             Advantage: Easy!
             Disadvantage: Wastes gobs of virtual memory 
	     (i.e. disk space) on tiny problems.


         What I'd like to do:
	     Set the initial array size to a fair value and
	     allow the program to 'realloc' during run-time if needed.

	     COMMON / MEMORY / DYNMIC(25000)

	     Advantage: Better use of resources.
	     Disadvantage: I don't know how to accomplish it.

    One technique that a local Convex guru told me about involved
    using an assembler, but I'd like to avoid that level if
    possible and stay within the realm of f77, cc, ld, and UNIX
    calls from within f77/cc.  Is there a way to move the location of
    a global to the end of the executable (in ld)?  If so, then I
    might be able to pass the address of the common to a C function
    to realloc. (Can this method work?  It sounds good on paper.)

Reply by mail and I'll summarize the results.
Thanks in advance to all who care to contribute their 2 cents.

-- 
    Dan Dawson
    ddawson@csd4.csd.uwm.edu
-------------------------------------------------------------------------
As a child, I was seen but not heard.  Now I'm obscene and not heard.