From owner-freebsd-hackers Sun Dec 17 10:41:57 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id KAA12182 for hackers-outgoing; Sun, 17 Dec 1995 10:41:57 -0800 (PST) Received: from expo.x.org (expo.x.org [198.112.45.11]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id KAA12176 for ; Sun, 17 Dec 1995 10:41:53 -0800 (PST) Received: from exalt.x.org by expo.x.org id AA03801; Sun, 17 Dec 95 13:41:20 -0500 Received: from localhost by exalt.x.org id SAA19173; Sun, 17 Dec 1995 18:41:19 GMT Message-Id: <199512171841.SAA19173@exalt.x.org> To: hackers@freefall.FreeBSD.org Subject: Re: growing X server processes In-Reply-To: Your message of Fri, 15 Dec 1995 13:37:05 EDT. <6990.819031025@critter.tfs.com> Organization: X Consortium Date: Sun, 17 Dec 1995 13:41:18 EDT From: "Kaleb S. KEITHLEY" Sender: owner-hackers@FreeBSD.ORG Precedence: bulk > > I use it for everything. Without gnumalloc my server would easily > > grow to ~10meg and never shrink. This was not very good on my 8meg ram/ > > 32meg swap machine to have a third of my swap consumed by unused server > > > You should try out the malloc in -current then. I would probably do even > better than gnumalloc in low-ram environments. > Here's a patch that is a slight improvement over the malloc.c in -current. If you run a ktrace on the simple test program that I posted previously you'll see that it behaves a little better in that case. But it's still not perfect. With this patch my X server idles at ~3.5meg, as opposed to ~4meg without it and ~3meg using gnumalloc. I think this points out that your free page management needs to be rethought. -- Kaleb *** /usr/src/lib/libc/stdlib/malloc.c-current Sun Dec 17 06:55:28 1995 --- /usr/src/lib/libc/stdlib/malloc.c Sun Dec 17 08:18:21 1995 *************** *** 493,498 **** --- 493,499 ---- malloc_init () { char *p; + static void * malloc_bytes (size_t); #ifdef EXTRA_SANITY malloc_junk = 1; *************** *** 593,598 **** --- 594,606 ---- malloc_ninfo = malloc_pagesize / sizeof *page_dir; + /* + hackity hack hack, pre-allocate the freepage list pointer to + improve odds of being able to return pages to the OS that are + allocated by the first calls to malloc. + */ + px = (struct pgfree *) malloc_bytes (sizeof(struct pgfree)); + /* Been here, done that */ initialized++; } *************** *** 990,996 **** pf = px; px = 0; } else if (pf->end == ptr ) { ! /* Append to the previuos entry */ pf->end += l; pf->size += l; if (pf->next && pf->end == pf->next->page ) { --- 998,1004 ---- pf = px; px = 0; } else if (pf->end == ptr ) { ! /* Append to the previous entry */ pf->end += l; pf->size += l; if (pf->next && pf->end == pf->next->page ) {