Re: [linux-audio-dev] java real-time deliverability

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] java real-time deliverability
From: David Slomin (dgslomin_AT_CS.Princeton.EDU)
Date: pe syys   10 1999 - 00:53:33 EDT


On Thu, 9 Sep 1999 est_AT_hyperreal.org wrote:

> David Slomin discourseth:
>
> > My prior experience with JVM's has been that they _never_ garbage collect
> > until they actually run out of memory.
>
> It's not true anymore, but even if it were, is that something you can
> dependably code to for an application used in performance situations?
>
> > I don't know if this is still the
> > case; I know that the garbage collection process is usually a major point
> > of concern in garbage collected languages like Lisp. However, Java has
> > managed to squeak by in this because most Java programs (and especially
> > applets) are small and short-lived, so they tend not to run out of memory
> > during their lifespan.
>
> Well, you can be very imperative in Java. You can simply not allocate
> during performance periods.

That's half the solution; the other half is to manually call the garbage
collector before entering each performance period. You can do this with
java.lang.Runtime.gc(). It doesn't return until the garbage collecting is
finished, so you don't have to worry about it being nasty in the
background. You can also monitor how close you are getting to the next
out of memory triggered garbage collection point by calling
java.lang.Runtime.freeMemory().

With functions like these, a lazy garbage collector (doesn't collect until
out of memory) is actually preferable to a more aggressive one, since it
leaves you free to control it in the aforesaid manner. So much for the
modern "improvement".

Div.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:27:11 EST