Mopping Up Mozilla Memory Leaks 300
mouseman writes "Geodesic Systems, a maker of memory management/debugging software, has a live demo of their Linux product running on the Mozilla nightly builds. It's pretty damn slick -- it detects memory leaks and can show where in the code the leaked memory was allocated and actually recover (GC) the leaked memory. The Mozilla reports actually look pretty good, which jibes with my own impressions of how much it has improved -- see for yourself."
Just what they need... (Score:2, Insightful)
Re:Just what they need... (Score:4, Informative)
Re:Just what they need... (Score:5, Informative)
Re:Just what they need... (Score:2, Informative)
Re:Just what they need... (Score:1)
memory leaks, moz, and slash (Score:5, Funny)
You can hear me screaming down the street.
It is a little better under IE, but I prefer to use Moz.
Re:memory leaks, moz, and slash (Score:2)
I've tracked this specific leak for 5 YEARS now... (Score:2)
I know that when I have moderator status here on slash, I can watch the system resources disappear down a block hole if I hit a story with a lot of comments and I use Moz.... It is a little better under IE, but I prefer to use Moz.
I've been tracking this particular bug for a LONG time, and couldn't get anyone at the former Netscape to do anything about it. I haven't pestered the current Netscape or Mozilla teams because I haven't actually used the current browsers, and consequently expected I'd receive a poor welcome. But it sounds like the bug IS in still in the codebase, per the above-quoted comment.
Specifically, the resource leak occurs when there are a lot of links INSIDE table cells, AND those links contain a lot of text. This apparently has a trigger threshold since if you sufficiently cut down the amount of text displayed as links, the leak goes away. Worst case, a large table with lots of long links can suck resources to zero in 30 seconds flat.
It appears that checkboxes, radio buttons, and dropdown boxes occuring inside table cells can also trigger the problem, tho I don't have this pinned down to exact cases.
Symptoms vary with the NS version and the WinVersion under it, but in general you will notice oddities like vertically overlapping text and checkboxes that go invisible. An example that affects NS3.04 is Slashdot's own "User Preferences" page, with its zillion checkboxes.
This bug is apparently in ALL versions of Netscape, but only visibly manifests in certain versions. To my certain knowledge, 3.04-16bit (running on Win16 or Win32), 3.04-32bit, and 4.64 are the worst affected, but apparently it can be triggered in ANY version if you work at it hard enough. 3.02-16bit Gold, 4.00-32bit, and 4.04-32bit are somewhat less affected than average.
People using the old Delphi forums (which were horrible for triggering the leak) griped about the symptoms constantly, regardless of NS version. Of course most had no idea what was happening, only that using Delphi crashed their computer.
So long as you haven't actually zeroed out the system, resources will usually recover by 90+% after you leave the triggering page.
The bug is ALSO definitely in IE3.0. I don't personally know about other versions other than that IE5.01 seems somewhat resistant to it (but I only use IE as a last resort, so...) But per the quoted comment, the bug is clearly not absent in recentish versions (I assume no one here is insane enough to still be using IE3 :)
Correct me if I remember wrongly, but don't IE and NS both ultimately derive from the Mosaic codebase? The implication is that this is a core bug in the foundation code.
BTW there is also a resource leak that happens if you view a page that has SWF on it, but you do NOT have the SWF plugin installed. The leak is approx. 25% per SWF box per page, and unlike the above-mentioned leak, resources do NOT recover when you leave the affected page. This affects NS 3.04-32bit and 4.04-32bit equally, haven't checked other versions. I suspect this is another manifestation of the same leak, since SWF-inside-tables also seems to be involved.
Affected sample of the SWF/tables resource leak: http://www.blkviper.com/index.html (however, NO leak IF you have the SWF plugin installed).
I'm not a coder, but I can contribute testing if desired.. I hope this information finds its way to the appropriate people (or if someone knows who I should contact, I'll do it myself), and that this bug is finally fixed!
Re:System Resources on Windows 9x (Score:2)
Which is just another reason for me to finally get off my butt and build that freebsd box i've been thinking of.
Memory Leak Detectors and Garbage Collectors (Score:5, Informative)
I'm gonna need people's help to add to the list below.
Here is a list of (freeware) Memory Leak Detectors and Garbage Collectors -
ccmalloc
http://www.inf.ethz.ch/personal/biere/projects/cc
Valgrind
http://developer.kde.org/~sewardj/
Boehm Collector
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
Parallel Collector on Message Passing Environment
http://www.yl.is.s.u-tokyo.ac.jp/gc/dgc/
If there are more out there, would you kindly add what you have to the list, please ?
Thank you !
Re:Memory Leak Detectors and Garbage Collectors (Score:3, Informative)
http://www.andreasen.org/LeakTracer/ [andreasen.org]
MemWatch
http://www.linkdata.se/sourcecode.html [linkdata.se]
These are two free memory debuggers that I've used, and had much success with.
Alternative memory debugger (Score:5, Informative)
Of course it doesn't do much in the way of garbage collection (well, anything) but it's still a great tool.
I wish I had a memory lead detector... (Score:4, Funny)
Now where did I put that mop and bucket?
Re:I wish I had a memory lead detector... (Score:2, Funny)
Sometimes memory leaks are a good thing to test tolerance for a massive numbers of zombie processes! Leave them in, let malloc() have some fun. Tell your boss, "I'm testing the swapfile", and then say,
"These memory leaks demonstrate that as more memory is used for a process, the less effective the L1 and L2 become and the more delays you get due to the massive pipeline stalls in the P4. So that's why we need to upgrade to AMD, *please* sign my expenses form immediately and ignore that pron and DVD recorder"
Memory leak detector. Great I need one of those because, uhhhh can't remember. I need to get rid of a bug which does a malloc and then uhhh oh man it just slipped my mind. My computer doesn't need a memory leak detector, instead the thing that needs a memory leak detector is uhhhh I was about to say something but forgot.
Moral of the story: A PDA is better at stopping memory leaks than any memory leak detector.
Interesting (Score:2, Interesting)
Now the only question I have are
1) can it be used as a debugger too ?
2) how does it compare to other systems like electricfence ?
Re:Interesting (Score:2, Informative)
> available for Linux, we are always looking for
> interesting pieces of software to do this job.
> Now the only question I have are
> 1) can it be used as a debugger too ?
Yes
> 2) how does it compare to other systems like electricfence ?
Take a look at the demo (perhaps when it is less slashdotted) and draw your own conclusion. It is pretty self-explanatory.
Re:Interesting (Score:2)
I've been an Insure (was Insight) user for 5-6 years now, and it is a wonderful tool. It will save you many person-hours of painful debugging, especially if you use C (like we do).
YES!! (Score:2, Interesting)
JoeLinux
Re:YES!! (Score:1)
Moz fonts (Score:2)
IT renders pages faster (Score:1, Funny)
Memory Usage Trends (Score:5, Informative)
Download the installer and run it. Moz will launch automatically after install. Kill Mozilla and restart it. Bring up the task manager to see how much memory is used.
Here's the results I've had on my W2k box:
2001 10/01 build 03 22,540k
2001 10/15 build 06 21,876k
2001 10/18 build 03 21,692k
2001 10/23 build 09 21,984k
2001 11/16 build 03 21,952k
2001 11/29 build 03 21,656k
2001 12/06 build 03 19,868k
2001 12/10 build 03 19,812k
2002 01/07 build 03 18,124k
2002 01/14 build 03 19,064k
2002 01/17 build 04 19,244k
2002 02/26 build 03 18,608k
2002 03/06 build 04 18,220k
2002 03/11 build 04 17,704k (build 0.9.9)
That's a decrease of almost 5 megs in memory usage over six months - all the while they've been adding features.
Significantly, they've added venkman, tabbed browsing, the dom inspector and favicon support.
Also significant - I don't know why I bother to get the talkback builds anymore - I haven't submitted a crash in 3 months. And I run it all day, every day.
Re:Memory Usage Trends (Score:2)
Mozilla 0.9.9 is using 16,683k on the same machine and OS. I think the decrease in memory usage has to do with removal of a lot of debugging stuff and what not, that'd be my guess. How much optimization is taking place with Mozilla, and how much time is spent on new features and bug fixes?
IE6 is part of windows itself (Score:2)
So how much memory does the windows Kernel, Explorer.exe and IE6 use all together?
You cant find out how much memory IE6 uses on WindowsXP, maybe on Windows95 you can.
Re:IE6 is part of windows itself (Score:2)
Re:IE6 is part of windows itself (Score:2)
Re:IE6 is part of windows itself (Score:2)
Yeah thats why when IE crashes, Explorer.exe crashes.
IE is part of explorer.exe
You can kill explorer.exe and still run IE, it doesnt change the fact that IE is a component for Explore.exe,
Mozilla is a seperate program using XUL to for the interface which is why its slower, its NOT native.
IEs interface components are part of Explorer and the Kernel so the interface is faster.
Re:Memory Usage Trends (Score:2)
Mozilla is decreasing in size by 1 meg per month.
At the going rate, Mozilla won't take up any memory by August 2003 !! Imagine the start up times! How will IE compete?
;-)
Re:YES!! (Score:1)
GOD I HATE STUPID WINDOWS USERS
Re:YES!! (Score:2)
GOD I HATE STUPID WINDOWS USERS
Oh, self-loathing is so sad ...
Re:YES!! (Score:2)
Pan
Re:YES!! (Score:2)
I am, however a software engineer, so my first inclination is to offer up possible reasons for the "perception" of slowness, and things that could be improved.
Personally I don't really care.
Re:YES!! (Score:2)
Re:YES!! (Score:2)
Re:YES!! (Score:2)
The only thing that MS is faster at is startup, and this is comparing Win32 to Win32. Moz is even faster on Linux.
I use Moz as my Windows browser 99% of the time, the only time I load up IE is to test pages I design for compatibility, and to view corporate sites that insist on using non-standard HTML. ("Best viewed with IE = Not W3C compliant")
Re:YES!! (Score:2)
Also, I really like how IE on the favorites/bookmark bar, the last favorite on the right is a pull down list. This is the only thing I think Mozilla needs. Bookmarks on your personal toolbar should emulate IE. Annoying, but doable.
And yes, why does finance, marketing and hr still make IE only websites? Everyone else in the company, even our administration websites from vendors work with Mozilla!
spellchecker (Score:2, Informative)
Have you tried out the one at http://spellchecker.mozdev.org [mozdev.org]?
Re:YES!! (Score:2)
but if Moz numbered like MS, where the first semi-stable build was 4.0, that probably wouldn't be too far off the mark.
Other Platforms (Score:4, Interesting)
Re:Other Platforms (Score:2)
Err, no. When an application exits on a well-behaving OS, everything it malloc'd is free'd. Everything. Even if the folks writing the app screwed up. Even if the compiler screwed up. It all gets freed.
Memory leaks can still happen in kernelspace (kmalloc'd stuff not being kfree'd), but that's hardly an issue -- kmallocs happen much more infrequently than real mallocs, and kernel code tends to be of much higher quality than userspace code (and far tighter, so one can see where the kmallocs and kfree pairs are in any one module/driver/source/other unit).
The only other memory leaks are userspace, so when the program that's leaking dies or is restarted, the memory is reclaimed; hence, leaks in these apps are hardly a problem, except perhaps in long-running programs or really horrendous leaks. Several server systems (like apache) automatically restart their threads after handling a certain number of transactions so that in the event that some module or whatnot has added a small memory leak, it is prevented from becoming a problem even on long-running server processes.
In short, ya can't pin it on buggy code -- a good OS won't care if the app code is buggy or not.
Re:Other Platforms (Score:2)
> my original statement is quite correct. And somehow I think if I had just said that
> Windows sucks and left Linux out of it that nobody would have challenged it.
If you had said Windows 98 sucks, yes, nobody would have argued with that. But NT, 2000, XP, and flavors of unix shouldn't have this problem.
I think the real problem is that your OS is not accurately reflecting how much memory is actually available. For instance, if it caches data read off the disk, it may very well keep the disk cache around after the process exits.
Whether I free() my memory or not, the operating system has the exact same job at the end of a process's life. This *can't* be an application problem.
Re:Other Platforms (Score:2)
> It certainly can be. I realize that any good OS has its memory protected, but there are
> still many apps that allocate memory outside of their designated heap.
How do they do that?
These days, a process has a large unified address space, and if it needs memory, it gets it from there. The OS cleans up afterwards. Or are you talking about other resources? (Other resources may typically leak, I will not deny that.)
Debugger integration? (Score:3, Interesting)
I've been using NuMega products within MSVC for a number of years. I used Purify before that. I haven't used the latest version from NuMega, but I've always had a lot of success with BoundsChecker (memory profiler, error detection, etc), True Time (performance profiler) and True Coverage (code usage profiler).
I wouldn't even know where to start looking for open source equivalents of these products. Can anybody give me any pointers? Preferably for Windows, but also Linux. How does this product compare with the likes of those from NuMega and Rational?
Re:Debugger integration? (Score:5, Informative)
Maybe not as pretty, but does the same thing... (Score:5, Informative)
I bet someone could write a ld_preload kind of thing that calls ccmalloc, and you could run it on the completed binary as well, so you could run 'ccmalloc
Here is ccmalloc's page.
http://www.inf.ethz.ch/personal/biere/proj
Re:Maybe not as pretty, but does the same thing... (Score:3, Informative)
Garbage collectors, leak detection, and Mozilla (Score:4, Informative)
ccmalloc (Score:2, Informative)
ccmalloc is a great utility to have if you can't get your hands on purify
Hmmm.. (Score:1, Redundant)
Garbage collector (Score:4, Informative)
Re:Garbage collector (Score:3, Funny)
Re:Garbage collector (Score:5, Funny)
1. Do obscure pointer arithmatic for fun.
2.
3. Profit!
Sorry.. I couldn't resist
Re:Garbage collector (Score:2)
Garbage collection in a pointer-arithmetic enabled language is doomed to suck.
Re:Garbage collector (Score:2)
They actually search your program's memory bytes for data that "looks like" pointers.
This has significant disadvantages:
A Conservative GC has to search through all of your memory bytes to find pointers, whereas a GC-enabled language will know at runtime exactly where the pointers are stored, making it much faster at collecting. This defeats the purpose of using a "fast execution" language in the first place.
A Conservative GC has no way to know which piece of data is a pointer, and which is just data. This means that if you just store random data, you get random pointers, and a conservative GC will simply leak. This is definitely not the "Right way" to work.
The information of which bytes in your program are pointers and which are just data is available at compiletime (and thus it can be available at runtime, too).
Conservative GC is a "hack" around GC-disabled languages to try and get GC functionality, so it cannot use this data and must waste time searching for "pointer-like" data.
If this doesn't suck, I don't know what does.
Re:Garbage collector (Score:2)
Memory leaks?
As to your arguments:
#1: The Boehm collector can work the way you described, and works very well that way. BUT, you can specify options to the collector that disable that, or limit that behavior. Using the collector this way doesn't slow the program down.
#2: Conservative collectors DO leak. That's part of their nature. But, the leak characteristics are entirely different. Leaks introduced by a human tend to grow until the program runs out of memory completely. Leaks introduced by a conservative collector grow in a bounded fashion, typically 2x the amount of memory required by a perfectly leak-free system. This "bounded leak" characteristic is not necessarily a bad thing, since it gives the safety of a garbage collector and the ability to plan an appropriate memory size for a server.
You're right that GC is a "hack", but it works pretty damn well, and it can make a difference between a million line program that leaks like hell and crashes all the time, or a million line program that runs and doesn't crash.
You're also right that the language isn't really meant to be garbage collected. I would like to see a "gc" keyword in a future language spec to provide support for an (optional) garbage collector.
Re:Garbage collector (Score:2)
If you want high-level functions such as garbage collection, just use high-level languages that do it better (Java, Python, etc), profile the result, and write specific slower portions in C or C++.
Re:Garbage collector (Score:2)
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
Parasoft insure (Score:3, Interesting)
Is there some other Mozilla out there (Score:3, Interesting)
After reading the Salon article [salon.com] about how improved and fast it was now, I decided to give it a whirl on my NT desktop at work.
I uninstalled it after about 15 minutes. It was just slow. Sluggish in loading pages, slow in creating new windows, everything. Not only was it slower than IE 5.5 but what surprised me was that it was slower than *Netscape* 4.7, which is what I primarily use. It's a shame because it had some nice options.
What am I missing? Is it not meant to run on NT? Is it debugging code? Would it run better on XP? I'd love to give it a chance but apparently, I got some other Mozilla browser instead of the one everyone here is raving about.
Re:Is there some other Mozilla out there (Score:1)
Re:Is there some other Mozilla out there (Score:3, Informative)
see: http://www.mozilla.org/releases/mozilla0.9.9/#ins
Re:Is there some other Mozilla out there (Score:2)
One thing though, opening new windows is something Moz is bad at. Try setting up the tabs feature which is both lightening fast, and in the opinion of everyone I've met a vast improvement. Again, this is one of those I don't know why things - if someone described the idea of tabs to me, I'd have said it sounds horrible. But it isn't.
Be aware that while Mozilla is physically slower and more memory hungry, it's still a lighter browser over all. It takes around 66% of the download space of a recent MSIE, despite also having email and IRC and whatever, and even manages to be smaller than Netscape.
Beautiful, just beautiful.
Re:Is there some other Mozilla out there (Score:5, Interesting)
It may be slower and consume more resources but at least it uses less disk space?
That's really not an argument the open source community should be making.
Re:Is there some other Mozilla out there (Score:2)
Re:Is there some other Mozilla out there (Score:2)
It takes around 66% of the download space of a recent MSIE...
as "it takes less disk space than MSIE".
Re:Is there some other Mozilla out there (Score:2)
You said:
[I]t's still a lighter browser over all. It takes around 66% of the download space of a recent MSIE, despite also having email and IRC and whatever, and even manages to be smaller than Netscape.
What exactly *were* you referring to then if not diskspace? Just the download file?
Great, that's an even better argument.
More bloat and less speed from a smaller file. Talk about efficiency. Maybe Microsoft could learn from this...
Re: (Score:2)
Re:Is there some other Mozilla out there (Score:2)
1. It was a throwaway comment.
2. It's generally a good thing when the installation package is small. Sure, it's not 1.44megs so you can't bung it on a floppy, but as part of a standard install in a company, or something on your backups of stuff, it's pretty nice.
3. Have you ever downloaded a multimegabyte file using a normal modem? No, didn't think so.
Geez. If I said "This car has some problems, but it corners well" you'd have been back at me with "Oooooooooh! The car's huge and all you care about is that it has a big steering wheel!"
Or "One thing I like about this way this chicken is cooked is that it's fairly spicy" would garner the response "Oh great. So you're eating this fattening chicken and risking botulism and all you care about is that it makes you sneeze!"
Jesus H. Christ. Read what I fucking say next time ok? Is that too much to ask? Or couldn't you find anything more controvertial you could twist out of context today? I'm surprised you didn't go further: "5 million Cambodians are dead and all you can care about is saving precious bytes in your download folder", "India and Pakistan are on the verge of nuking one another, and you think Mozilla rocks because it's got a good installer?" "Yeah, I know who else made compact installation packages too: Hitler. That was what Hitler did!"
Geez.
Re:Is there some other Mozilla out there (Score:2)
No other Mozilla, no debugging code, it really is that fat and bloated. On a fast machine, it is faster than IE in some places. In others, it is pigishly slow.
Being faster than IE in some places lets some people argue that it is faster and better than IE. It is not. I use Mozilla exclusively though. I find the performance disappointing but tolerable, however, it cuts out advertising and supports Internet standards.
The memory footprint is abhorrant. The tool in the demo spots leaks, not usage. I've never had serious problems with leaks in any web browser. Normally they crash long before I have to worry about them consuming too much memory.
I think Mozilla is particularly bad on Win32 OSes because the virtual memory managers in Windows will swap out unused allocated memory in exchange for HDD cache. This means if Mozilla is inactive for 10 minutes or so, it will get swapped out so that your drive cache can gain another 50MB. Oddly, IE doesn't appear to suffer from this. It would not be unlike Microsoft to introduce an undocumented API which allows apps to behave differently in swap, but that's just speculation.
On the other hand Linux appears to use virtual memory as a last resort. I'm not sure which scheme I like better. Windows could use being less agressive in how it expands cache.
Of course that is not to say that Mozilla isn't a pig. It is.
I think Mozilla will revolutionize the Internet and the way in which web browsers work, but it might not be through their own success, it might be through opening of standards and immitation of their technology.
Re:Is there some other Mozilla out there (Score:2)
Stop using pentium 4/586! (Score:2)
Mozilla requires 300mhz machine at LEAST.
You shouldnt be using it on an old as hell machine. Its slow because your CPU is slow, period. they cant make your CPU faster. I mean the problems you complain about are CPU load problems not problems with ram.
Re:Stop using pentium 4/586! (Score:2)
Because CPU's are dirt cheap. The amount of money you need to buy a modern CPU (low end) gives you one, maybe two hours programming time of a junior programmer. A professional programmer earns much more per hour and is good for maybe around 5 to 10 minutes of his/her time. So don't waste his/her time and buy a new CPU with the hardware to insert it into. You can pick up good second hand hardware for a price that is just about the same price of most commercial software packages (if you insist on being a cheap bastard). If it is your hobby to run new software on old hardware that's your problem.
Re:Is there some other Mozilla out there (Score:2)
Re:Is there some other Mozilla out there (Score:2)
Mozy will run a little faster and you will not have all that extra memory allocated to IE while not using it. it works on everything from Win 2k to win98 FE.
Re:It is definitely slower than NS4.7 (Score:2)
Low memory machines might still find NS4 faster overall, I haven't really had a chance to try mozilla on a loaded 32MB machine yet. At work, we have many of these left in use and they have to run software like mcafee which uses a huge amount of memory itself. There won't be much RAM after that to make mozilla happy I don't think
Have to Check it out after the beatings (Score:4, Informative)
Re:Have to Check it out after the beatings (Score:2)
Re:Have to Check it out after the beatings (Score:2)
A similarly ugly pile of Java code was delivered to our team to maintain just recently. This was the result of an attempt to migrate some of our functionality to Java and the project was handed to a guy with no CS experience in school or out. He ended up copying the (hideous) design of the existing C code and delivered code that was not only as hideous as the original C code, it was harder to maintain due to a complete lack of comments (Which was in turn due to a complete lack of understanding about what the product actually does.)
Much of the project is, in fact, set to be ported to Java at some point. I believe the team doing that is currently about a year behind schedule. This does not so much reflect on their abilities as programmers (With certain exceptions) but rather that the system is actually being designed this time and involves business units from several geographic locations and code from about a dozen diverse teams.
Re:Thank Bruce Perens (Score:2, Funny)
Wow, I think this is the first time I've ever seen an AC say something nice about Bruce Perens. I'm in shock!
Open Source gives back (Score:5, Funny)
Re:Open Source gives back (Score:2)
memprof (Score:5, Informative)
It's available at http://people.redhat.com/otaylor/memprof/ [redhat.com]
Freshmeat has an entry for it [freshmeat.net] as well.
What I'd really like... (Score:2, Interesting)
adéu,
Mateu
Re:What I'd really like... (Score:2, Informative)
Who needs garbage collection? (Score:3, Insightful)
(To those who didn't get it, I was being cynical)
That is the response I usually get when advising to write using high-level languages that take care of memory management. Finding enormous leakage in huge programs almost proves this response wrong. Finding leakage in almost all programs definitely proves it wrong, and you sure will find leakage in almost every large program written in a low-level language like C or C++.
The overuse of low-level languages with increasingly powerful hardware is becoming appearant to more and more people. It seems the "dark side" will be out of the low-level language hell sooner, as Micros~1 is pushing C# and
If you don't want the Linux/*nix world to stay behind, stop using C and C++ where Python and Lisp can be used. Writing in C or C++ instead of a higher-level language can be deemed as a premature optimization, as any specific part of the program can be optimized and written in C when necessary. We all know how evil premature optimization is.
If you write in C or C++ because that's simply what you know, you should not be wary of learning new languages. You should know that C++ is extremely hellish to learn, while Java is a lot simpler, and Python takes at most a day or two!
From my own personal exprience, functional languages are a bit more difficult to learn and grasp, but it seems they perfectly fit some mindsets.
Stop wasting human power on writing destructors and freeing unused memory, when it can all be done automatically.
Re:Who needs garbage collection? (Score:2)
C and C++ are definitely assembly-level languages. C especially can almost be translated to assembly fairly straightforward; it's just a nicer syntax for assembly. Both languages, however, force you to deal with 'machine' issues, such as allocating and freeing memory. In higher level languages, such as ML, scripting languages, and (kind of) Java, you don't worry about keeping the 'machine' happy.
There is a whole slew of non-low-level languages that are out there. Work with them and learn what is 'high' and what is 'low'. It's a sad situation that we're stuck with so many people writing everyday applications in assembly-level languages.
Re:Who needs garbage collection? (Score:2)
A day or two?!
Almost all the work involved in that kind of thing is done in underlying libraries -- database retrieval, output formatting, and so forth. I'm actually involved in maintenance of the software running a mid-sized car dealership, and can say with absolute certainty that the bottlenecks involved in payroll processing (and importing new partlist data, and credit report retrieval, &c) aren't even remotely related to high-level code execution speed. In fact, we've had (much!) bigger problems when payroll (in particular, commissions) were delayed due to bugs in the old code; and office workers stalled by crashes in our unsafe code have cost the company far, far more than the unnoticable decrease in execution time involved in our newer, safe code.
We're not talking a matter of days, but of seconds if that -- even dealing with large datasets, the bottleneck is almost always in the database itself (and other I/O issues) and not in the control language (and other CPU-time issues).
Re:Who needs garbage collection? (Score:2)
It frees memory slower than most modern garbage collectors and it doesn't work for cyclic references.
Re:Who needs garbage collection? (Score:2)
I suggested it so people understand learning new languages will not be as hard as it was to learn C++ (or Perl).
Re:Who needs garbage collection? (Score:2)
There aren't always C++ compilers or libraries for those platforms.
I doubt C and C++ are the most portable, except for tiny hardware which cannot run JVM's or a Python interpreter (in which case, cannot run Mozilla either)
Nice leak detectors built into Mac OS X (Score:5, Informative)
The Mac OS X's malloc library has built-in support for providing good leak detection. The command line tool leaks (installed with the free developer tools [apple.com]). Although leaks can be run on any program, it works best when you set the enviromment variable MallocStackLogging, which causes the system to provide complete stack frame information about when each piece of leaking memory was allocated.
Also of interest are the malloc_history and heap command-line tools. They tell you lots of interesting information about exactly what is on the heap and how it got there. The malloc library also detects double frees by default (making it immune to the recent zlib security vulnerability) and can also detect writing on free blocks, etc. Very nice.
Finally there is a graphical application, MallocDebug which provides similar information on memory leaks and memory use but also provides an easy to use memory-browser interface. Unlike simple leak detectors, you can explore your program's memory space and discover memory that isn't strictly "forgotten" by your program (it still has valid references to it) but should perhaps have been deleted anyway (e.g., finding memory allocated for a splash screen graphic). This last application requires that the code use a special library, but it is easy enough to make dynamically-linked programs use this library (thanks to Darwin's equivalent of LD_PRELOAD, DYLD_INSERT_LIBRARIES).
Although you can debug any code with these tools (from command-line tool to X-windows, Carbon or Cocoa app), they really shine debugging Objective-C, because Objective-C provides enough runtime information for the tools to tell you lots about the objects that are sitting there on the heap.
MozillaQuest (Score:2, Funny)
you don't need Geodesic's stuff (Score:4, Informative)
A more basic question to ask, however, is why something like Mozilla has memory leaks in the first place. Avoiding memory leaks in C is hard because there simply are no hooks in C to automate resource management. But C++ has constructs that make writing leak-free code and code that doesn't use bad pointers pretty easy. Since switching from C to C++ a few years ago, memory leaks and bad pointers have simply not been an issue anymore in my code.
Irony (Score:2)
We apologize for the inconvenience, but you will need a frames- and javascript-capable browser to use Great Circle's web-based debugger. We support Netscape Navigator 4.74 and 5.0 and Microsoft Internet Explorer 4.01 with SP2, 5.0, and 5.5.
So I could look at this Mozilla memory leak thing -- but... uh, not in Mozilla...?
(Don't get me started on Javascript. You really don't want to hear me rant about that.)
The real problem is the language (Score:2)
Adding garbage collection introduces a whole new set of problems. C++ destructor semantics doesn't play well with garbage collection. ("Hey, that window will get closed at the next GC, just be patient!") Finalization opens a whole can of worms of its own (C# supports "re-animation", where dead objects can come back to life during finalization).
Perl's reference-counting, with strong and weak pointers, has easily understood semantics, but there's a performance overhead. A big advantage of reference counting is that objects go away when you expect them to, not at some random time later. So destructors get called when expected.
I proposed a way to retrofit efficient reference-counting into C++ (search comp.std.c++ for "Strict C++) but it just doesn't fit without making larger changes to the language than the C/C++ crowd can stand.
I'd like to see reference counting with compiler support, with reference count updates hoisted out of inner loops. This would yield efficient reference-counted programs. We'll probably never see this.
Currently posting from my new favorite browser (Score:2)
The tabbed browsing is as cool as everyone said it was. I can keep a browser window for each context (one works on my app, one has my blog, another has
Plus developing in it is heaven. The DOM inspector saved my sanity twice today. I'm still trying to figure out the JavaScript Debugger (it won't break on my breakpoints), but it looks pretty cool.
It's crashed a few times on me today, once when screwing with the DOM inspector and another when changing between themes. So it's not perfect when it comes to stability. Neither was IE when I switched from Netscape and that didn't stop me.
The one thing I don't like is the plugin support. I have JDK 1.4 installed, but it doesn't see Mozilla. When I went to the plugin page for it, it tried to install 1.3. I tried to install quicktime and it didn't see it. I'm thinking I need Netscape installed at the same time for these to work properly.
Switched to Mozilla the day before yesterday... (Score:1, Offtopic)
Re:Slashdotted already? (Score:1, Offtopic)
and, guess what, your pressiouse Mem foot print, well I looked at my memory used before I IERadicated my IE, after ward, I gained a ton of memory with out IE on my system.
IEs memory foot print is hiden from you, that is why it takes windows so long to load, because IE is in memory at boot.
Netscape WAS Mosaic (Score:2)
Netscape was the company who originally made Mosiac if i remember right, before they were called netscape.
Re:Netscape WAS Mosaic (Score:2)
IIRC you can get even older versions at http://browsers.evolt.org/index.cfm/dir/navigator