Clearing Java objects to solve memory leak

There is a memory leak in our application. To try identifying the
problem, got a heap dump and used the Eclipse Memory Analyzer to look at
the dump.

The analysis points to the POI library. A very common use case in our
application is people do a query, get a list of records and export the
records to Excel. Using the POI library, its easy and fast to dump a
recordset to an Excel spreadsheet in the controller and send the
spreadsheet back to the browser.

This has to be some kind of bug in jRuby however is there something I
can do to clean up the POI Java objects to eliminate the leak? I’m
thinking I can walk through all the Cell and Row objects and set them to
null but I don’t know if this will work.

you could check which objects reference the [leaking] objects, and why
they’re still around.