[comp.unix.ultrix] Malloc Problems with DECstation 5000/200

ian@ssc-vax.UUCP (Ian R. Searle) (04/16/91)

Has anybody out there been having malloc problems on a DECstation
5000/200? We have 32 Meg of RAM, and 150+ swap, output from
pstat -s below:

157688k swap configured
21948k reserved virtual address space
	20236k used (4640k text, 0k smem)
	137452k free, 1224k wasted, 0k missing
avail: 4291*32k 140*1k

We are having troubles getting a single process to malloc more than
60 Mbytes, we can get the same program running in separate windows
to malloc over 120 Mbytes, but a single instance of the program
cannot seem to grab more than about 60 Mbytes. The simple test
program listed below can grab 32 Mbytes, 60-70 Mbytes when linked
with "gcc -o test test.o -lmalloc". BTW when we run this program
there is plenty of free swap according to pstat -s.


#include <stdio.h>
main( int argc, char *argv[] )
{
	void *p;
	int num;

	num = atoi( argv[1] );
	p = malloc( num*1000000 );
	if ( p == NULL ) {
		printf( "That's it.\n" );
	} else {
		printf( "Got it.\n" );
	}
	if ( p != NULL ) free ( p );
}

Can anybody point out what in the world I'm doing wrong (no this is
NOT a trick question).

Thanks in advance, Ian Searle

alan@shodha.enet.dec.com ( Alan's Home for Wayward Notes File.) (04/16/91)

In article <3853@ssc-bee.ssc-vax.UUCP}, ian@ssc-vax.UUCP (Ian R. Searle) writes:
} Has anybody out there been having malloc problems on a DECstation
} 5000/200? We have 32 Meg of RAM, and 150+ swap, output from
} pstat -s below:
} 
} 157688k swap configured
} 21948k reserved virtual address space
} 	20236k used (4640k text, 0k smem)
} 	137452k free, 1224k wasted, 0k missing
} avail: 4291*32k 140*1k
} 
} We are having troubles getting a single process to malloc more than
} 60 Mbytes, we can get the same program running in separate windows
} to malloc over 120 Mbytes, but a single instance of the program
} cannot seem to grab more than about 60 Mbytes. The simple test
} program listed below can grab 32 Mbytes, 60-70 Mbytes when linked
} with "gcc -o test test.o -lmalloc". BTW when we run this program
} there is plenty of free swap according to pstat -s.

	What is the value of maxdsiz in the configuration?  If
	left to default the data space of a process on a DECstation
	is limited to 64 MB.  You can also check it by using the
	csh(1) limit built-in.

	See the "Guide to System Configuration File Maintainence"
	for rules on changing the value.
} 
} 
} [ Program deleted. ]
} 
} Can anybody point out what in the world I'm doing wrong (no this is
} NOT a trick question).

	It's almost certainly a limit problem.
} 
} Thanks in advance, Ian Searle

	You're welcome.


-- 
Alan Rollow				alan@nabeth.cxn.dec.com

ian@ssc-vax.UUCP (Ian R. Searle) (04/17/91)

Hello, as it turns out I have "sort-of" solved my own problem, but
I would still like to hear from anyone who can explain the remaining
puzzle.

The problem of a single process size not growing beyond 60-70
Mbytes when we have 157 Mbytes of swap was due to the parameters
in /usr/sys/conf/mips/NODE-NAME (configuration file). Specifically
maxdsiz was set to 64. Upping this to 128 and rebuilding the kernel
solved our problems, sort-of.

We still cannot malloc a single chunk of memory larger than 32
Mbytes when using the standard malloc. When we link with -lmalloc
we can get up to 128 Mbytes (the value of maxdsiz). Why the diff??

thanks in advance, Ian Searle.

jpyll@lhdsy1.chevron.com (Philip Y. de Louraille) (04/17/91)

In article <3853@ssc-bee.ssc-vax.UUCP>, ian@ssc-vax.UUCP (Ian R. Searle) writes:
> Has anybody out there been having malloc problems on a DECstation
> 5000/200? We have 32 Meg of RAM, and 150+ swap, output from
> 
> We are having troubles getting a single process to malloc more than
> 60 Mbytes, we can get the same program running in separate windows
> to malloc over 120 Mbytes, but a single instance of the program
> cannot seem to grab more than about 60 Mbytes. The simple test
> 
> Thanks in advance, Ian Searle

Well, Ian, first type limit in your csh, what do you get for the datasize parameter?

The problem that you have is that there is a maximum size for the datasize. It is defaulted to 64 Meg for the 5000.

In /sys/conf/mips/HOSTNAME, add or change the parameter "maxdsiz" followed by a number in Megabytes and rebuilt the kernel.
For a datasize of 120 Meg, you should have
maxdsiz 120.

After rebuilding the kernel and rebooting, type limit and unlimit to push (for that csh) all limits to their max sizes.
That should do it. (typing unlimit should not be necessary, unless your .cshrc sets some limits for you.
Ha!, do not set your maxdsiz bigger than your swap space! Hell may break loose!
-- 
  Philip Yzarn de Louraille                 Internet: jpyll@chevron.com
  Research Support Division                 Unix & Open Systems
  Chevron Information & Technology Co.      Tel: (213) 694-9232
  P.O. Box 446, La Habra, CA 90633-0446     Fax: (213) 694-7122