home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!yale.edu!cs.yale.edu!rtnmr.chem.yale.edu!rescorla
- From: rescorla@rtnmr.chem.yale.edu (Eric Rescorla)
- Subject: Re: FLAME, FLAME ON X!!!
- Message-ID: <1992Nov18.194905.16185@cs.yale.edu>
- Sender: news@cs.yale.edu (Usenet News)
- Nntp-Posting-Host: rtnmr.chem.yale.edu
- Organization: Rescorla for himself.
- References: <1683@igd.fhg.de> <1992Nov9.235741.25166@dsd.es.com> <1992Nov18.183826.2652@lsl.co.uk>
- Date: Wed, 18 Nov 1992 19:49:05 GMT
- Lines: 36
-
- In article <1992Nov18.183826.2652@lsl.co.uk> snail@lsl.co.uk writes:
- >In article <1992Nov9.235741.25166@dsd.es.com>, pmartz@dsd.es.com (Paul Martz) writes:
- >> Care to tell us in which vendor's X is this a bug? I've certainly
- >> never heard of it before.
- >
- >This is NOT an X bug. This is a feature of C's memory allocation routines. When
- >memory is allocated, if there is no spare space, the C library asks the
- >OS for more memory, but when memory is freed, C does not give the memory back
- >to the OS. As a result programs can only get bigger, or stay the same size as
- >memory as allocated and freed. The program gets bigger every time memory is
- >requested and cannot be allocate out of the current free heap space. When this
- >happens the C library ask the OS for more memory. When the memory is freed,
- >it is returned to the free memory heap, not the OS.
- >
- >*** This is not a UNIX feature, this is a C feature, to be found on PCs, Ataris
- >, UNIX boxes, VAXes etc. This a feature, ie: C is designed this way. ****
- >
- >My apologies for replying to this thread 3 days late, someone has probably said
- >this before. But then again, maybe they haven't.
- I hope not. It's wrong. It is not part of the definition of the
- C language or of malloc(3). It happens that it is a very common way to
- do things, because sbrk(2) calls are expensive and it's not obviously
- worthwhile to return memory to the system. (This is on Unix. I imagine
- that similar conditions obtain on other machine.)
-
- However, it would be quite legal to return the memory to the OS. I believe
- Jim Frost mentioned previously that he had in fact written such a malloc
- routine.
- -Ekr
-
-
- --
- -------------------------------------------------------------------------------
- Eric Rescorla, DoD#431 (Nighthawk S) rescorla@rtnmr.chem.yale.edu
- Former chemist now CM400 mechanic ekr@eitech.com(preferred)
- "Meet the new boss, same as the old boss."
-