Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* swap/malloc problem
@ 1996-06-07  4:00 George Grevera
  1996-06-08  4:00 ` M. van Wijk
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: George Grevera @ 1996-06-07  4:00 UTC (permalink / raw)



Hi.  I seem to have tons of swap space but can't malloc a measly
135M.  The particulars are 96M of physical memory on a DEC 3000
running OSF1 V3.0.  I don't have a /sbin/swapdefault file.

swapon -s reports:

    Swap partition /dev/rz1b:
        Allocated space:        49500 pages (386MB)
        In-use space:               1 pages (  0%)
        Free space:             49499 pages ( 99%)

    Swap partition /dev/rz3b:
        Allocated space:        20480 pages (160MB)
        In-use space:               1 pages (  0%)
        Free space:             20479 pages ( 99%)


    Total swap allocation:
        Allocated space:        69980 pages (546MB)
        In-use space:               2 pages (  0%)
        Available space:        69978 pages ( 99%)

The program that bombs is simply:

    #include <assert.h>
    #include <stdio.h>
    #include <stdlib.h>

    int main ( int argc, char* argv[] ) {
        char* cp = malloc(135000000);
        assert(cp != NULL);
    }

I can't understand why this fails.  Thanks for your help.


George
ggrevera@gradient.cis.upenn.edu



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: swap/malloc problem
  1996-06-07  4:00 swap/malloc problem George Grevera
@ 1996-06-08  4:00 ` M. van Wijk
  1996-06-09  4:00 ` Dan Pop
  1996-06-10  4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
  2 siblings, 0 replies; 4+ messages in thread
From: M. van Wijk @ 1996-06-08  4:00 UTC (permalink / raw)




On Friday, June 07, 1996, George Grevera wrote...
> The program that bombs is simply:
> 
>     #include <assert.h>
>     #include <stdio.h>
>     #include <stdlib.h>
> 
>     int main ( int argc, char* argv[] ) {
>         char* cp = malloc(135000000);
>         assert(cp != NULL);
>     }
> 
> I can't understand why this fails.  Thanks for your help.
I'm afraid I can't understand either. I think they assumed nobody wants to
allocate such an amount of memory. But I found a workaround!

Surprisingly, it works if you link with -lpthreads -lmach. The ptreads
library contains thread safe versions of some libc calls, including
malloc. Somehow that malloc can handle bigger requests.

Marc van Wijk
m.vanwijk@student.utwente.nl




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: swap/malloc problem
  1996-06-07  4:00 swap/malloc problem George Grevera
  1996-06-08  4:00 ` M. van Wijk
@ 1996-06-09  4:00 ` Dan Pop
  1996-06-10  4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Pop @ 1996-06-09  4:00 UTC (permalink / raw)



In <4p9kis$6sg@netnews.upenn.edu> ggrevera@gradin.cis.upenn.edu (George Grevera) writes:

>Hi.  I seem to have tons of swap space but can't malloc a measly
>135M.  The particulars are 96M of physical memory on a DEC 3000
>running OSF1 V3.0.  I don't have a /sbin/swapdefault file.

You've been bitten by the default datasize limit:

    ues5:~ 170> limit datasize
    datasize        131072 kbytes
    ues5:~ 171> limit datasize unlimited
    ues5:~ 172> limit datasize
    datasize        1048576 kbytes

So, without further system tuning you can get as much as 1 GB of virtual
memory space for your process, but the default is set at 128 MB.

Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@cern.ch 
Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: swap/malloc problem
  1996-06-07  4:00 swap/malloc problem George Grevera
  1996-06-08  4:00 ` M. van Wijk
  1996-06-09  4:00 ` Dan Pop
@ 1996-06-10  4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Rollow - Dr. File System's Home for Wayward Inodes. @ 1996-06-10  4:00 UTC (permalink / raw)




In article <4p9kis$6sg@netnews.upenn.edu>, ggrevera@gradin.cis.upenn.edu (George Grevera) writes:

>Hi.  I seem to have tons of swap space but can't malloc a measly
>135M.  The particulars are 96M of physical memory on a DEC 3000
>running OSF1 V3.0.  I don't have a /sbin/swapdefault file.
>
> [ swapon -s and sample program deleted ]
>
>I can't understand why this fails.  Thanks for your help.

There are a variety of per-process and system parameters that
limit the amount of virtual memory a process can have.  Some
shells implement a per-process limits, but such shell typically
offer built-in commands to control the limits.  The C-shell
for example has the limit built-in command.

There are system wide per-process limit.  Once upon a time these
were controlled by the parameters maxssiz, maxdsiz and maxtsiz
in the configuration.  I haven't paid close enough attention,
but these may haved move to sysconfigtab and are thus easier
to change.  There is also probably a system wide virtual memory
limit.  How to raise these (and the per-process default) should
be documented in the system management documentation.

>George
>ggrevera@gradient.cis.upenn.edu
>
--
Alan Rollow				alan@nabeth.cxo.dec.com




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-06-10  4:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-06-07  4:00 swap/malloc problem George Grevera
1996-06-08  4:00 ` M. van Wijk
1996-06-09  4:00 ` Dan Pop
1996-06-10  4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox