From owner-freebsd-hackers Wed Dec 6 13:40:31 2000 From owner-freebsd-hackers@FreeBSD.ORG Wed Dec 6 13:40:29 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from earth.backplane.com (placeholder-dcat-1076843399.broadbandoffice.net [64.47.83.135]) by hub.freebsd.org (Postfix) with ESMTP id DA11337B6A2 for ; Wed, 6 Dec 2000 13:40:24 -0800 (PST) Received: (from dillon@localhost) by earth.backplane.com (8.11.1/8.9.3) id eB6LdkE99051; Wed, 6 Dec 2000 13:39:46 -0800 (PST) (envelope-from dillon) Date: Wed, 6 Dec 2000 13:39:46 -0800 (PST) From: Matt Dillon Message-Id: <200012062139.eB6LdkE99051@earth.backplane.com> To: Remy Nonnenmacher Cc: phk@critter.freebsd.dk, freebsd-hackers@FreeBSD.ORG Subject: Re: free() not freing pagedirs pages. References: <200012061907.UAA31917@luxren2.boostworks.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG : :OK. In fact my problem was just a printf that allocated a buffer via :__smakebuf at the very last moment (when all memory was allocated). :This prevent free() to give back all previous pages up to this one. The :problem was _not_ in malloc.c. : :Anyway, i learned a lot from hacking the source to catch the caller. :Thanks. : :RN. :IhM Not to mention library routines which might malloc() something and keep it around. I find that the best way to allocate a large chunk of memory is to use mmap( ... MAP_ANON ... ). That way you have complete control over the memory. You need only page-align the request size (getpagesize() helps there). You can then manage the memory with madvise(), and free it completely with munmap(). -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message