Re: how to forcely release heap in UNIX



At Tue, 30 Oct 2007 00:41:08 -0700 manusha1980@xxxxxxxxx wrote:


This just says what UNIX does it does not say why you might need this.
And the article by Eric Sosman that is referenced only suggests that you
probably don't need to worry about this.

and one another question. when will actually this memory be released
to the os. is it possible for OS to force the process to release this
memory? otherwise it might waste a lot of memory for a program that
allocates a huge chunk of memory in the initialization and frees all
of it, but never reallocates memory for its life time. (this is the
problem im having).

How is it a problem? If your system is really memory tight, the unused
memory will be swapped out to the backing store (swap file) and sit
there. Unless you are working with an embedded system or some such,
this does not really matter. Again, *exactly* how is this a problem?
Linux never 'wastes' memory, even if your program might seem to.




--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@xxxxxxxxxxxx -- Contract Programming: C/C++, Tcl/Tk

.



Relevant Pages

  • Re: Improved INCLUDE_CONFIG_FILE
    ... running kernel as well as the config file that was used to build it. ... having the config file loaded strikes me as a waste of RAM. ... In the whole scheme of things, it's not a lot of memory, and ...
    (freebsd-current)
  • Re: Thoughts on efficient bytecode and variable storage (longish)
    ... That would waste space for all not ... > a string length changes, ... and allocate fresh memory for the new content. ...
    (comp.lang.misc)
  • Re: RosAsm injects extra bytes into your data
    ... you wind up wasting 75% of the memory in the data space. ... > Bytes more or Bytes less in a dead File (and even ... on the average you will waste about 2K of memory in your data ... what's not important is saving main RAM. ...
    (alt.lang.asm)
  • Re: RFC: CONFIG_PAGE_SHIFT (aka software PAGE_SIZE)
    ... make it OK to waste lots of memory. ... We've had the same memory waste issue on ppc64 with 64k hardware ... you can handle different page sizes in the hardware (like ... MIPS) and the use of 64k base page size is an obvious workaround to ...
    (Linux-Kernel)
  • Re: [patch 09/10] Remove the SLOB allocator for 2.6.23
    ... Owaste, so I guess by savings I mean that SLOB's memory saving compared ... to SLUB are proportional to n). ... Waste in the kmalloc array in the ...
    (Linux-Kernel)