🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.graphics.avs
Article #5

field allocation memory problem

#5
From: Adam K. Usadi
Date: Thu, 29 Oct 1992 18:29
76 lines
3755 bytes
Hello.

I use AVS 3.0 on an HP 9000 series 700 with 32Mb of real memory 
(and 60+Mb of virtual memory) and keep on encountering a 
memory problem when allocating large AVS fields.  I know 
someone recently asked about a shared memory problem on another 
machine recently, but I believe that this is a different problem. 

Here is the code from the data allocation/computation subroutine of 
the module
=================================================================
    AVSfield_float *input;  /* define field variable*/
    AVSfield_float *vinput;
                      .
                      .
                      .
	if (*data) { 
		printf(" Freeing old scalar memory\n"); 
		AVSdata_free("field", input); 
	}
    if (*vdata) { 
		printf(" Freeing old vector memory\n"); 
		AVSdata_free("field", vinput); 
	}

	/* nxyz = number of data points  typically ~ 1E6 */
    fprintf(stderr, " about to allocate memory for (nxyz=%d)...\n", nxyz);

    input = (AVSfield_float *) AVSdata_alloc(
              "field 3D scalar rectilinear 3-space float", dim);
    vinput = (AVSfield_float *) AVSdata_alloc(
            "field 3D 3-vector rectilinear 3-space float", dim);
=================================================================

Each time I read in a new data set I free the old memory and allocate 
a new field so that I can easily manipulate data sets of different sizes
concurrently.

When running this once, it works fine.  However, if I try to read in
another data set of the same large size, it crashes with the following
messages:

======================================================================
 Freeing old scalar memory
 Freeing old vector memory
 about to allocate memory for (nxyz=916300)...
/vega/users/usadi/AVS/Modules/read_mhd: can't put field in shared memory: shmget: Not enough space
/vega/users/usadi/AVS/Modules/read_mhd: Allocation of field failed! (10999113 bytes)
 calculating coordinates...
avs: tcp_read(): Unexpected end of socket
fork failed: Not enough space
======================================================================

In other words, it doesn't seem to be freeing the old memory, at least
not before attempting to allocate new memory.  In addition, I have no
idea where the number  (10999113 bytes) is comeing from.  It should 
allocate a scalar field of ~1E6 points and a vector field of ~1E6 points.
Both are defined as float and hence, a total of 4 arrays of 1E6 points
should be allocated (~16mbytes ????).

If, after reading in a large data set, I then read in a small data set,
and then read in another large data set, it seeems to work.  In other
words, AVS seems to be out of synch with the OS in that it doesn't
immediately purge old memory.

Is there a way to force memory freeing at a certain time (i.e. before
attempting to allocate new memory?)  Has anyone encountered this
problem?  Any suggestions?  E-Mail or post.

Thanks,
Adam Usadi

-- 
Dept. of Space Physics and Astronomy       (713) 527-8101 ext 3551 (OFFICE)
Rice University, P.O. Box 1892             (713) 285-5143          (FAX)
Houston, Texas 77251-1892                  E-MAIL: usadi@spacsun.rice.edu
Technical Details
Message-ID: <BwwBCG.Mux@rice.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!darwin.sura.net!jvnc.net!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!bcm!rice!spacsun.rice.edu!usadi

Show Full Headers
Complete Article Headers
Newsgroups: comp.graphics.avs
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!darwin.sura.net!jvnc.net!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!bcm!rice!spacsun.rice.edu!usadi
From: usadi@spacsun.rice.edu (Adam K. Usadi)
Subject: field allocation memory problem 
Message-ID: <BwwBCG.Mux@rice.edu>
Keywords: shared memory fork field 
Sender: news@rice.edu (News)
Reply-To: usadi@spacsun.rice.edu (Adam K. Usadi)
Organization: Dept. of Space Physics, Rice University, Houston TX
Date: Thu, 29 Oct 1992 18:29:04 GMT
Lines: 76