Hi,

We've encountered an interesting Java memory usage problem that occurs
when using lazily-constructed data structures. The problem is that a
single data structure, such as a list, may not fit into memory all at
once, so it's important to not hold a reference to the parts that are
no longer in use. Unfortunately, Sun's Java GC follows local variables
even when they can be statically known to be no longer in use, such as
after they are passed to a function call and never again referenced.
This only seems to be the case with the bytecode interpreter, but an
out-of-memory error can occur well before the affected code is JIT-
compiled.

This issue is most common in lazy languages implemented on the JVM,
such as our language, CAL, but it affects any JVM program using lazy
data structures. In Open Quark 1.7.0, which was recently released, we
include a couple solutions to fix this problem for CAL. Both involve
nulling variables once they are no longer used, which is trickier than
one might think. I describe these in more detail in my post to the CAL
Language group (http://groups.google.com/group/cal_language/
browse_thread/thread/728a3d4ff0f77b00).

These solutions fix our problem, but it would be even better to have
the problem handled in the JVM. For example, perhaps the JVM could JIT-
compile every method on the call stack whenever an out-of-memory error
occurs, since that might help the GC enough to recover from the error.

Thoughts?

- Malcolm Sharpe


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to