Re: Perf. 1.0 memory usage

New Message Reply Date view Thread view Subject view Author view

Michael Jones (mtj++at++babar)
Fri, 4 Feb 1994 09:41:01 -0800


On Feb 4, 11:33am, Jean-Francois Richard wrote:
> Subject: Perf. 1.0 memory usage
:
:Somebody just pointed out to me that my Performer 1.0 application
:appears to have a size of about 70,000 pages (that's 280 Mb!)
:according to the ps and top commands. That is very interesting
:(and potentially dangerous) since the machine it is running on
:only has 128 Mb of combined physical and virtual memory. In real
:life, the program never seems to actually use more than 15 to 20 Mb.
:
:The memory appears to get reserved when I call pfInit(). Does Performer
:need to reserve that much memory? Is there a chance that it might try
:to actually use it and run out of swap space? Is there a way to
:control Performer's appetite so that the other users of the computer
:won't freak out when they look at my processes?

The default allocation is 256MB. This issue has been dealt with in the
upcoming 1.2 release of IRIS Performer with the new pfSharedArenaSize()
function: just call it before your pfInit() call. Here's the reference
page for the new functions (also pfSharedArenaBase() can be handy too).

pfSharedMem(3pf) Silicon Graphics pfSharedMem(3pf)

NAME
     pfInitArenas, pfGetSharedArena, pfGetSemaArena, pfTmpDir, pfGetTmpDir,
     pfSharedArenaSize, pfGetSharedArenaSize, pfSharedArenaBase,
     pfGetSharedArenaBase - Shared Memory Functions

C SPECIFICATION
     #include <pr.h>

     long pfInitArenas(void);
     void * pfGetSharedArena(void);
     usptr_t * pfGetSemaArena(void);
     void pfTmpDir(char *dirname);
     const char* pfGetTmpDir(void);
     void pfSharedArenaSize(ulong size);
     ulong pfGetSharedArenaSize(void);
     void pfSharedArenaBase(void *base);
     void * pfGetSharedArenaBase(void);

DESCRIPTION
     pfInitArenas creates a shared memory arena that can be used to allocate
     memory, locks and semaphores from (see pfMalloc, pfNewSema, pfNewLock).
     This function is called by pfInit so it is not necessary to call it when
     using libpf functions. Calling pfInitArenas again after using pfBlist,
     pfBpipe, pfQueue, pfNewLock, pfNewSema will have adverse affects due to
     the resetting of internal data structures.

     pfInitArenas uses usinit to create arenas for both locks and shared
     memory. These arenas are reflected in the Unix file system. Where these
     files are created is important. There must be as much space available to
     the file as is allocated for the arenas. 16K bytes are allocated for the
     locks and semaphores, which supports approximately 4K locks.

     pfTmpDir and the environment variablle PFTMPDIR control where
     pfInitArenas creates its arenas. If neither is specified, the semaphore
     arena is created in /usr/tmp and the shared memory arena is created in
     /dev/zero (swap space). If a temporary directory is specified, then
     files are created in that directory for the shared memory and semaphore
     arenas. Both these files are unlinked so that they are removed from the
     file system when the process terminates. Once created, these arenas
     cannot grow, so Performer tries to create a large (256MB) arena.

     For shared memory, swap space, the default, is usually preferable to
     using a file in a directory specified by PFTMPDIR. Using an actual file
     is slightly slower at allocation time and requires actual disk space for
     extending the file length to equal the amount of memory allocated
     (pfMalloc) from the arena.

     Swap space under 4.0.5 is not resevered or allocated until pfMalloc, so
     Performer can create a large arena without tying up actual swap space
     until it's used by pfMalloc. But under 5.0.1/5.1, arena space needs to
     be reserved up front. In this case, Performer limits the size of its
     shared memory arena to a fraction of the currently available swap space.
     This may cause some moderate or large applications to fail during
     pfMalloc. To avoid this problem under 5.0.1/5.1, increase the virtual
     size of swap space by creating a zero length file called /swap and adding
     a line to /etc/fstab:

               /swap swap swap vlength=5000000

     and reboot the system. Under 5.1.2, this is no longer necessary since
     Performer uses a new IRIX mechanism for reserving swap space as the arena
     usage grows.

     pfSharedArenaSize can be used to override the arena size that Performer
     uses by default (256MB). size specifies the desired size in bytes.
     pfGetSharedArenaSize returns the arena size in bytes.

     pfSharedArenaBase sets the base address for the mapping of the shared
     memory arena. Normally, IRIX chooses the base address. This is useful
     if the application needs closer control over the layout of virtual
     address space, e.g. to avoid conflicts with other mappings.
     pfGetSharedArenaBase returns the base address for the arena.

     pfGetSemaArena returns a handle to the lock arena and pfGetSharedArena
     returns a pointer to the shared memory arena. This pointer cannot be
     used directly, only as an argument to pfMalloc. pfGetTmpDir returns the
     temporary directory set using pfTmpDir.

NOTES
     These arenas can only be used by related processes. Meaning those
     processes that share a common heritage. Use pfDataPool for sharing
     memory between unrelated processes. pfInitArenas should be called before
     any other forks or sprocs are made.

SEE ALSO
     acreate, usinit, pfMalloc, pfFree

-- 

Be seeing you, mtj++at++sgi.com 415.390.1455 M/S 7L-590 Michael Jones Silicon Graphics, Advanced Graphics Division 2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:10 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.