We have a wonder accounting application that is misbehaving. As part of the application the user processes a large amount of transactions, generating invoices and so on in a single LongResponse Thread.
public void _run() {
editingContext.setUndoManager(null);
editingContext.lock();
try
{
setup();
createPaymentReceivedAndMadeTransactions();
editingContext.saveChanges();
NSNotificationCenter.defaultCenter().postNotification(Repayment.REPAYMENT_TRANSACTIONS_PAID, accountGID);
}
catch (Exception e)
{
editingContext.revert();
e.printStackTrace();
}
finally
{
editingContext.unlock();
editingContext.dispose();
System.gc();
}
}
You will notice the GarbageCollector call in the finally catch. I have checked the advice on this link: https://en.wikibooks.org/wiki/WebObjects/EOF/Using_EOF/Memory_Management#Calling_System.gc.28.29 . I tried multiple solutions to reduce the load but to no avail.
I have profiled the application and there is a tiny memory leak but mostly with repeated processing of payments (one after the other) the GC does not seem to clear the memory fast enough and the application runs into problems.
http://imageshack.us/photo/my-images/841/withgcclear.png/
http://imageshack.us/photo/my-images/145/withoutgcclear.png/
I would very much like to get your opinions before going to garbage collector for a solution.
Regards,
Mouradk