--- In .com,
"Brian Jewell" <brian.jewell@...> wrote:
>
> We are using a TS7250, running the Java J9 VM. Every so often, there are
> "java.lang.OutOfMemoryError" exceptions thrown in the code.
There
seems to
> be no consistencies to the problem. It sometimes happens within hours of
> rebooting the TS, or sometimes within days, or sometimes not at all.
I (well, actually some of my students) had a problem like this once on
a PC running windows XP. We didn't have a profiler, so we used the
Runtime object.
You can call Runtime.getRuntime(), which returns a reference to this
virtual machine's one-and-only Runtime object. Once you have that, you
can query it for maximum, total, and free memory. So we stuck some
println()'s at strategic places in the code and watched the free
memory go up and down. We eventually found two different problems:
-- A function which was mistakenly looping too many times,
instantiating objects and sticking them into a tree. Fixing the bug
fixed the problem.
-- A function which needed to recurse quite deeply. Analyzing the
memory usage led us to start the VM with a command-line argument that
told it to ask for more memory. The analysis told us how much to ask for.
Maybe this will help...