Re: Memory reclamation under Linux(es) ?




Dances With Crows wrote:
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.


Errm, actualyy, the article, which is confirmed by my experience,
pointed
out that (1.01), 1.5, and 2.0 suffer from leaks. I upgraded, before
reading
the article, hoping this had been fixed. Like you said, though, I
probably
shouldn't have jumped the gun.

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.


While I don't consider Debian every, or even the best, distro, they
offered
the 2.4 kernel as an install option, and the 2.4 kernel was, last I
knew, still
being supported and patched. But that does answer the question. I was
hoping age would have improved the doc situation, as newer stuff
(kernels,
Apache projects[1], etc) tends to be pretty thin in the docs dept.[2]

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.


mfree() is a derivative of free(), used in at least one publicly
released library
(I can't remember which one; I think it was bundled w/ a tutorial on
programming
in C), and there's also an mfree() and/or an xmmfree() in gdb.

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.


Useful, in that I had forgotten that ps could show VSZ. %^$%^, firefox
and kde are memory-hungry!! I think I have a partial solution to my
problem. More below.

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.


That would be like me offering to help fix the Hubble telescope. I'm
pretty
handy with tools, a multimeter, and the occasional silly-scope, but
nowhere
near qualified enough.

My problem thus far has been leaving my computer running for days on
end.
Supposed to be ok, running Linux and all, right? Slowly, memory leaks
out...
to the point where free shows 6 MB (I have 320, + 256 swap). However,
it occurs to me that I should probably logout when I am away
from my computer, in addition to shutting firefox down: firefox is a
known
leaker, and ps auxw shows kde to be almost as much of memory hog...
So, by paring my running system down to gdm + daemons. perhaps
some of this memory problem should disappear.

Thanks,
Tarkin

[1] I still love you , Apache! And no, I'm not volunteering- until I
get a
better job that pays more for less hours. As it is, I do skilled labor
for a
trifle; trying to produce accurate, intelligible docs after a day of
construction
work would be nearly impossible.

.



Relevant Pages

  • Re: Fight MemHogs?!
    ... Is there a way to make the kernel do that earlier? ... Firefox 2.0.0.3 and Kernel 2.6.11 ... "top" shows that firefox keeps all the memory. ... days is the source for many, but not all, browsers out there. ...
    (comp.os.linux.misc)
  • [Full-disclosure] [TZO-27-2009] Firefox Denial of Service (Keygen)
    ... Firefox Denial of Service ... All Firefox versions supporting the KEYGEN tag. ... Furthermore memory is leaked during the process. ... I am not saying the memory leaks include key material, ...
    (Full-Disclosure)
  • [TZO-27-2009] Firefox Denial of Service (Keygen)
    ... Firefox Denial of Service ... All Firefox versions supporting the KEYGEN tag. ... Furthermore memory is leaked during the process. ... I am not saying the memory leaks include key material, ...
    (Bugtraq)
  • Re: URGENT - Pls help...pls recommend - laptop purchase
    ... And my memory use hardly ever goes past 800MB. ... The programs constantly running include some database software, Skype, Messenger, Notepad, Thunderbird, another email/news program and Firefox. ... While Maxthon is a tabbed browser too, it handles these leaky sites far better. ... Firefox 3.0 has apparently fixed the memory leaks, we use Seamony at work and I see liitle difference in performance. ...
    (comp.sys.laptops)
  • Re: what means it that firefox keeps greying out?
    ... it's a lost cause and i have to kill firefox. ... Linux Consulting, Training and Kernel Pedantry. ... Memory and is Uninterruptable. ... I notice it happens more when I have Facebook ...
    (Ubuntu)