Hi all,
following a bug report from Mike Read (I didn't know anybody apart
from SPLAT and Treeview was using JNIAST), it seems there are memory
leak issues with the JNIAST FitsChan. In fact there are leaks both
in the java heap and in the C heap. Mike was creating, using, and
discarding (via the gc) millions of FitsChans in a servlet,
and this was causing the JVM to generate OutOfMemoryErrors and/or
the process to allocate so much system virtual memory that it got
terminated.
I spent some effort (~ 1 day) looking into this; the code (mine)
is a nasty combination of clever and incorrect, my only excuse is
that it was one of the earliest bits of java I'd written.
I can improve matters somewhat; I can fix the Java leak, though
not very elegantly, but memory still seems to be leaking on the C side.
No doubt a solution exists, but I really don't have the leisure
to look into this any more in the forseeable future, so I'm just
going to have to put a warning sign on the FitsChan class.
Probably, the number of people creating a large number of JNIAST
FitsChans is small (=1), so I doubt this will cause widespread
inconvenience. I sorted Mike out with an alternative arrangement
which involves doing an exec from java to a pure AST binary.
This message is just to notify anybody who is now or might in the future
try to work with, or handle bug reports about, JNIAST FitsChans,
that there is a known problem. Of course if somebody else is keen
to attempt to fix it, they're welcome.
The AST FitsChan class itself is quite blameless.
Mark
--
Mark Taylor Astronomical Programmer Physics, Bristol University, UK
[log in to unmask] +44-117-928-8776 http://www.star.bris.ac.uk/~mbt/
|