Re: Experiment: functional concepts in C
- From: lacos@xxxxxxxxxxxxxx (Ersek, Laszlo)
- Date: 15 Feb 2010 15:09:49 +0100
In article <fdd6608e-899e-498b-b081-2261b170b34d@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, santosh <santosh.k83@xxxxxxxxx> writes:
Richard Heathfield wrote:
Pascal J. Bourguignon wrote:
<snip>
Perhaps today, for short lived C processes, you just don't have to care
about free anymore. Just malloc, and exit.
Perhaps that's the reasoning used by the Firefox guys. When running
Win32, I choose Firefox rather than IE, but that's becoming a harder
decision than it should be. The other day, I peeked at Task Manager and
found that Firefox (which I rarely leave running for long because I know
it's a hog) had grabbed well over half a gigabyte of memory. I rarely
have more than one window open, and rarely more than one (perhaps two or
three, and very occasionally up to a dozen) tabs in that window. Half a
gigabyte. It's just ludicrous.
Are you sure that's physical memory?
It better be. I configure my system that way.
During normal use (similar to
what you describe), Firefox does grab over 500 megabytes of virtual
memory, but usually only about a couple of hundred Mb of physical
memory.
And that's an invitation for a stab in the back by the OOM killer.
Rather waste sincerely and honestly than speculate.
And it slows everything else down,
because less available RAM means more swapping, and more swapping means
more disk access.
(Yes, I know this was written by Richard.) Semi-modern workstations
should run without swap, in my opinion; "a few G or RAM should be enough
for everyone" :) Really, suppose you have 2G RAM, and some processes
spill over into swap. The random-like memory access patterns of several
processes are now reflected by the head movements of your consumer-grade
hard disk. (The I/O scheduler, if any, can help only so much.) You won't
be able to bring up a terminal or task manager to find / suspend / kill
the offender(s) in reasonable time.
In a desktop situation where swap would help, swap is no help. Most of
the time I like a clean and quick "out of memory, exiting" message more
than waiting for several minutes on the disk (and probably getting the
same message in the end).
I have no experience with solid-state drives, but consumer-grade thumb
drives etc have *catastrophic* random-write performance, especially the
bigger ones -- they are worse for swapping than traditional hard disks.
I notice though that all popular graphical browsers have roughly
comparable memory consumption. Certainly, in my experience, Firefox,
SeaMonkey, Galeon, Chrome. Opera tends to consume about 50 Mb less
than these.
I suppose browsers have to handle lots and lots of small objects, ie.
objects that don't deserve their own mmap()-ed pages in the default
malloc configuration. This likely leads to hellish heap fragmentation
and a huge heap VMA. It would be interesting to see how memory usage is
affected after a long browsing session, when one opens a pristine
window, closes everything else, stops all downloads, and clears all
history and caches. In that case, even the heap VMA should be trimmed.
Cheers,
lacos
.
- Follow-Ups:
- Re: Experiment: functional concepts in C
- From: Nobody
- Re: Experiment: functional concepts in C
- Prev by Date: Re: plz explain the programs output
- Next by Date: Re: Efficency and the standard library
- Previous by thread: Re: Experiment: functional concepts in C
- Next by thread: Re: Experiment: functional concepts in C
- Index(es):
Relevant Pages
|