Re: malloc/free question



On 01 Dec 2005 11:09:06 -0600, joe@xxxxxxxxxxxxxxx <joe@xxxxxxxxxxxxxxx> wrote:
> brk() is used to get memory from the OS, not give it back. Normally,
> free() puts the memory being released back onto th free list, so it
> can be allocated again without a system call.

Actually, brk() can be used (on some systems, at least) for both,
so free() may use it to release memory to the OS when appropriate.
Which is not necessarily often due to fragmentation.

--
Mikko Rauhala - mjr@xxxxxx - <URL:http://www.iki.fi/mjr/>
Transhumanist - WTA member - <URL:http://www.transhumanism.org/>
Singularitarian - SIAI supporter - <URL:http://www.singinst.org/>
.



Relevant Pages

  • Re: force_recycle
    ... def initialize ... puts "Memory before allocation:" ...
    (comp.lang.ruby)
  • Re: Problem porting from STLPort 4.5 to VC++ 7?
    ... puts what appears to be the size of the vector in the last element + ... In other words my vector is 8 int's and this statement puts 32 in ... std::set does not store its elements in contiguous memory. ... unhealthily on internal implementation details of a particular STL ...
    (microsoft.public.vc.stl)
  • [QUIZ SOLUTION] Happy Numbers (#93) - happy bases
    ... happy bases before I run out of memory, ... chief among them finding a copy of narray that has the ... puts "#is a happy base" ...
    (comp.lang.ruby)
  • Re: using reg expr with array.index
    ... puts fixed ... Esmail, since you are dealing with files I would like to revisit this. ... Since files a) are slower to read and b) are potentially large - especially larger than main memory - you might want to look for different solutions. ... An alternative would be to store a more compact representation of lines, e.g. as a MD5 hash and do the lookups of the second solution based on hash codes of lines. ...
    (comp.lang.ruby)
  • Re: Speicherauslastung einzelner Programme ermitteln
    ... Und falls man sich für das Maximum der Speicherauslastung über ... # A quick'n'dirty hack to get the maximum resident size in memory of a given ... puts "Encoding was too fast, ...
    (de.comp.os.unix.apps.misc)