On 2013-01-23, at 9:29 AM, Sisi Li wrote:

> Dear all,
> 
> 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.
> 
> Here is the code inside the run method of that thread:
> 
> public void _run() {
> 
> editingContext.setUndoManager(null);
> 
> editingContext.lock();

Is editingContext in the default EOObjectStoreCoordinator or one created 
specifically for this thread?  If in the default, this is going to impact other 
users.


> try
> 
> {
> 
> setup();
> 
> createPaymentReceivedAndMadeTransactions();
> 
> editingContext.saveChanges();

You probably want to do that in small batches, and dispose and re-creacte the 
EC every N transactions.  That will generally work much better for memory 
consumption.

> 
> 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 doubt that is going to solve this problem.


Chuck


> 
> 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
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> 
> This email sent to ch...@global-village.net

-- 
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/gvc/practical_webobjects

Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing 
Companies in B.C! 
Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of 
Canada’s Fastest-Growing Companies by PROFIT Magazine!









 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to