I facing some heap memory issues in AIX server IBM java.
Firstly explaining the issue, below is the method in java which is invoked by C# code and Java code return the array list. I.e report object run method gives the array list. Then c# code will write that, array list into an file. This is the existing framework.
public List runReport( Integer ifeId, List params ) throws ReferenceCoreException
{
ReportInterface report=new ReportInterface();
// sanity check
// run the report
// MED: need a way of getting this session's data source
return report.run( HibernateSession.getDataSource(), ifeObj, params);
}
catch ( Exception e )
{
throw new ReferenceCoreException( e );
}
}
Whenever we takes heap dump it is showing memory is fully occupied. I.e Xmx is 8 GB and heap dump also says 7.9 GB is full.
My question here is: Once the array list is returned it should ideally clear by GC. If not can I add finally block and make the report object to null like below?
public List runReport( Integer ifeId, List params ) throws ReferenceCoreException
{
ReportInterface report=new ReportInterface();
// sanity check
// run the report
// MED: need a way of getting this session's data source
return report.run( HibernateSession.getDataSource(), ifeObj, params
);
}
catch ( Exception e )
{
throw new ReferenceCoreException( e );
}
Finallay
{
report=null;
}
}
I feel if we make the report object to null then the connection between report object and array list returned by run method should be disconnected and GC can reclaim the array list heap memory. Is it correct? Please correct me if my understanding is wrong here.
Also suggest if we have any other approach to clear the array list once the report.run methods return the array list to C#?
Also why AIX server IBM Java is not throwing out of memory error, Java process is simply hanging?