Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jan 1998 00:18:42 -0600 (CST)
From:      Joel Ray Holveck <joelh@gnu.org>
To:        steve@visint.co.uk
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Weird malloc problem.
Message-ID:  <199801060618.AAA04044@detlev.UUCP>
In-Reply-To: <Pine.BSF.3.96.980105144332.15149A-100000@dylan.visint.co.uk> (message from Stephen Roome on Mon, 5 Jan 1998 14:54:19 %2B0000 (GMT))
References:   <Pine.BSF.3.96.980105144332.15149A-100000@dylan.visint.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help

> I just discovered that I can happily malloc 512M without any problem,
> even ps is sure that I've managed this, but seeing as I've only got about
> 150M total virtual memory available I'm a bit surprised. Should I be ?

IIRC (and I'm no expert), it is possible to sbrk your processes'
entire addressable memory space (all 2^32 bits), and never use it.
However, when you actually try to use it, then you get a core dump (I
think a SIGSEGV).  So, you call malloc, which sbrk's the block plus
its overhead.  Then malloc then puts its own before the block.  At
that point, then a actual page of virtual memory is assigned to the
block, not before.

I believe this is correct, but I could be mistaken.

-- 
Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan
   Fourth law of programming:
   Anything that can go wrong wi
sendmail: segmentation violation - core dumped



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801060618.AAA04044>