Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!mips!dimacs.rutgers.edu!rutgers!modus!gear!cadlab!martelli From: martelli@cadlab.sublink.ORG (Alex Martelli) Newsgroups: comp.unix.ultrix Subject: Re: free(2) doesn't give free -- what ?? Message-ID: <803@cadlab.sublink.ORG> Date: 29 Apr 91 12:32:17 GMT References: <2294@netmbx.UUCP> Organization: CAD.LAB, Bologna, Italia Lines: 20 weis@netmbx.UUCP (Dietmar Weis) writes: ... :Free(2) frees memory in a running process, but no other process can use it :then. free(2) ? Try "man 2 free" and you'll get "No entry for free in section 2 of the manual"... it's actually free(3), that is, a SUBROUTINE, *NOT* a system call, and it's built on top of brk(2) [or sbrk(2), same manual entry:-]. That's not nitpicking - it may be the key to a solution for your problem: you can rewrite the malloc/realloc/free routine-set, using brk(2) not just to get more memory when needed, but also to give it back to the system when possible. You can start with the memory-allocator example in Kernighan and Ritchie's "The C Programming Language", or with any of several more advanced packages, such as Conor Cahill's "Debugging-Malloc", Roberto Buratti's "High speed memory allocator", Larry Wall's own malloc() (from the PERL package), etc etc, all posted at one time or another on various sources groups. -- Alex Martelli - CAD.LAB s.p.a., v. Stalingrado 53, Bologna, Italia Email: (work:) martelli@cadlab.sublink.org, (home:) alex@am.sublink.org Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 250434; Fax: ++39 (51) 366964 (work only), Fidonet: 332/401.3 (home only).