home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!wupost!usc!snorkelwacker.mit.edu!bloom-beacon!INTERNET!dont-send-mail-to-path-lines
- From: dan@watson.ibm.COM (Walt Daniels)
- Subject: re: Memory leaks
- Message-ID: <072992.150730.dan@watson.ibm.com>
- Sender: daemon@athena.mit.edu (Mr Background)
- Organization: The Internet
- Date: Wed, 29 Jul 1992 19:07:30 GMT
- Lines: 23
-
- > When is a memory leak a memory leak. If I do many malloc's with
- >no dalloc's , does the memory remain leaked when the program exits?
- >Is the answer different in different OSs such as Sun,SCO etc... ?
- >Sinan
-
- I know of no OS that doesn't clean up at process end. [Unless your
- system is really broken and processes can cause kernel memory leaks.]
- However the X server process rarely (hopefully never) ends so server
- memory leaks are a severe problem. Similarly some user processes are
- long running so a client side leak will eventually cause problems.
-
- There is another effect besides leaks that happen for programs.
- Malloc works by using sbrk to create a large area that is then broken
- into smaller pieces as necessary. When that space runs out sbrk is
- called to get another large piece. If lots of free's occur and the
- topmost sbrk region is free it could be returned (and some but not all
- systems do). Thus the storage may become fragmented and the sbrk
- boundary may increase indefinitely until you start having problems.
- Typical programs that may show such anomolous behavior in this area
- are ones which repeatedly get a large area for an image then release
- it and get a small piece that comes out the previously big enough
- piece for the image.
-
-