[clug] Why isn't Java popular on the Linux Desktop? [SEC=PERSONAL]

Daniel Pittman daniel at rimspace.net
Mon Jul 13 19:43:05 MDT 2009

Sam Couter <sam at couter.id.au> writes:
> Martijn van Oosterhout <kleptog at svana.org> wrote:
>> But it makes it useless for interactive programs, since you have to
>> determine at startup how much memory you think you'll need during the
>> entire duration of the program. I understand the pressure argument, but
>> surely if the GC sees that 90% of allocated memory is really in use, it
>> could think to just allocate more from the OS...
> Yes, it's a pain. But how is the VM supposed to know what memory is really
> in use unless it runs the GC? You've just designed a VM that will use *all*
> your available memory before getting aggressive with the GC.

You are aware, Sam, that there are a whole slew of systems that use garbage
collection, and which /don't/ require this same preallocation, right?

> Aggressive GC is costly and there's no way to know ahead of time if it will
> pay off, so it's only done when necessary, ie, when memory is scarce.

Lisp was generally running the generational garbage collector based on memory
allocations some thirty years ago, giving good, solid results without having
to either preallocate the heap, or run into memory pressure first.

This is a well solved problem, and a sensibly designed GC process can protect
both performance and memory *without* having to go to extremes.  A threaded or
real-time GC implementation can do better than that, often.

> The limits on memory usage keep Java applications from getting out of
> control.

This can be a benefit, yes.

>> Put it another way: I can't think of another programming language that
>> requires you to specify at program startup how much memory you want to
>> use.
> Nitpick: It's the VM implementation, not the language.
> I can't think of another VM that does lazy GC like Java does.

You have to be kidding, right?  Leaving aside the plethora of commercial
Common Lisp implementations, the .NET CLR implementation from Microsoft, and a
bunch of other generational garbage collectors for languages including C/C++
exist in various stages of completion.

Heck, this has been a topic of academic study for an awfully long time.

> Languages like Perl and Python do their collection when objects become
> unreferenced. Java does it later and gains huge performance benefits for it.

...and, here, it sounds like you seriously believe that it isn't the specific
generational or other enhancements, but garbage collection based on something
other than reference counting, that is unique to Java.

Surely I must be misunderstanding you, right?

✣ Daniel Pittman            ✉ daniel at rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons

More information about the linux mailing list