From owner-freebsd-hackers Tue Jan 6 06:25:19 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.7/8.8.7) id GAA15179 for hackers-outgoing; Tue, 6 Jan 1998 06:25:19 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from wakko.visint.co.uk (wakko.visint.co.uk [194.207.134.12]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id GAA15166 for ; Tue, 6 Jan 1998 06:25:09 -0800 (PST) (envelope-from steve@visint.co.uk) Received: from dylan.visint.co.uk (dylan.visint.co.uk [194.207.134.180]) by wakko.visint.co.uk (8.8.5/8.7.3) with SMTP id OAA00941; Tue, 6 Jan 1998 14:31:46 GMT Date: Tue, 6 Jan 1998 14:24:45 +0000 (GMT) From: Stephen Roome To: Joel Ray Holveck cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Weird malloc problem. In-Reply-To: <199801060618.AAA04044@detlev.UUCP> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk On Tue, 6 Jan 1998, Joel Ray Holveck wrote: > 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. Not very logical though that I can allocate more memory than I have. To me at least. > 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. So, sbrk gets how much memory it can have from getrlimit, and what's happened is that I've been able to set either the soft or hard limit beyond some other more realistic limit which the vm system must already surely know about. So, does someone want to explain WHY getrlimit doesn't ask the relavent parts of the kernel before it decides what limits it will set for the user? Actually, as someone just pointed out, it's fine to set the limits to anything, but malloc should never think it suceeded in allocating virtual memory which clearly just doesn't exist! Steve -- Steve Roome - Vision Interactive Ltd. Tel:+44(0)117 9730597 Home:+44(0)976 241342 WWW: http://dylan.visint.co.uk/