Re: Memory reclamation under Linux(es) ?



On 30 Oct 2006 05:02:37 -0800, Tarkin staggered into the Black Sun and
said:
Firefox 2.0 has problems with memory leaks.

I think they may have jumped the gun on the release. Big surprise, eh?
This is why you never use the latest thing, you wait until all the
reports from early adopters filter in so you can decide if the bugs
reported are worth putting up with.

Are there any (up-to-date) [docs] on how 2.4 kernels manage memory?

You'd probably have better luck finding docs on the 2.6 series, since
everyone's using that now. I highly doubt the problem is with the
kernel, though, since you're not complaining about any other app having
memory leaks.

After a leaking application exits, is the memory reclaimed in any way,
other than releasing any 'locks'(?) the app had on it? Or are memory
leaks related to improper use/calling of mfree() and derivatives?

What's mfree()? Did you mean free()? When a process malloc()s
something, typically memory is allocated in page-sized (4K) blocks. The
kernel maintains several lists of unused pages, pages used by processes,
pages that have been moved to swap, etcetera. There is at least one
level of indirection between physical memory and and the page tables,
possibly 2 or 3.

A short C program that malloc()s and free()s a 10M chunk of memory shows
about 11M VSZ in ps auxw after the malloc, and about 1M VSZ after the
free. I don't know whether this is useful or reliable data, though.

Are there any user-space, third-party, or kernel extensions which keep
tabs on memory, akin to a garbage collector?

? Garbage collection is not done in C/C++. There are libraries like
ElectricFence that help you find memory leaks in C/C++ programs. If
you're interested in finding/fixing the leaks in Firefox 2, I'm sure the
developers would like people to help them out. Contact them, see what
they say.

--
Life is a persistent hallucination, Death a mere illusion.
Taxes, however, are Objective Reality.
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
.



Relevant Pages

  • Re: Memory Leak detection with HeapAlloc ... ?
    ... Your code won't detect memory leaks from HeapAlloc because it checks only those allocations taht were made via CRT. ... anyone knows of a solution where one could enable a page heap as described in the articles from sourcecode? ...
    (microsoft.public.vc.language)
  • Re: Memory Leaks?
    ... > not relinquish all memory back to the available pool for XP to use. ... To flesh this out a bit, memory leaks are a far greater problem in scripts ... When a script terminates, WSH runs a cleanup process that deletes the ... An object will be disconnected only after all references to it ...
    (microsoft.public.windowsxp.general)
  • Re: C++ Garbage Collector on VMS?
    ... Garbage collectors are *not* a cure for memory leaks. ... the garbage collector may be used as a leak detector for C or ...
    (comp.os.vms)
  • Re: COM interop between C++ and C#
    ... But we have detected lot of memory leaks from our side. ... leak detection is notoriously ineffective at preventing false positives. ... There are tools that help a little, but ultimately, short of manually inspecting 100% of your data structures and proving that some block of memory that is still allocated isn't referenced anywhere in your program, it can be hard to know for sure you actually _have_ a memory leak. ... Then these are compared to the known allocations (you also have to override the memory management API, of course, for easiest implementation). ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Garbage Colletor
    ... The Large Object Heap isn't compacted ... I'm specifically talking about memory leaks. ... A leak is a bug, but not all bugs are leaks. ...
    (microsoft.public.dotnet.languages.csharp)