Re: Out of memory
Re: Out of memory
- Subject: Re: Out of memory
- From: Chuck Hill <email@hidden>
- Date: Thu, 28 Jun 2007 08:27:20 -0700
On Jun 28, 2007, at 3:14 AM, Ken Anderson wrote:
In case you're not understanding what Uli is telling you here, he's
recommending that you use a new editing context instead of your
session editing context for each invocation. Although your myLog
instance will eventually be garbage collected, other resources that
EOF creates will live as long as the editing context does. It's
very inexpensive to create new contexts,
It is? It is memory expensive to create them, make changes, and keep
them around. But I don't recall it being expensive to create them.
Chuck
so unless you need objects to stick around for a while, it's a
really good idea to use editing contexts that will get garbage
collected as well.
Ken
On Jun 28, 2007, at 5:52 AM, Ulrich Köster wrote:
public class MyService implements IMyService {
public void storeToDB(String text1, String text2, String
text3, String text4, String text5) {
EOEditingContext ec = new EOEditingContext();
//or
// EOObjectStoreCoordinator parent = new EOObjectStoreCoordinator();
// EOEditingContext ec = new EOEditingContext(parent);
MyLog myLog = new MyLog();
myLog.setCol1(text1);
myLog.setCol2(text2);
myLog.setCol3(text3);
myLog.setCol4(text4);
myLog.setCol5(text5);
ec.insertObject(myLog);
ec.saveChanges();
}
}
uli
Am 28.06.2007 um 10:54 schrieb Muckenhirn, Ralf:
Hello,
I know there were some big discussions about that problem before.
But I have not found any solution for my problem until now.
I’ve created a small and very simple web-service using WebObjects
to reproduce my problem (see below). I then calling this web-
service from a small application by invoking with axis every 200ms.
When looking to the used memory of my web-service it will grow
continuously over the time. After a while (maybe 30 min to 1h) I
get a java.lang.OutOfMemory: Heap overflow error.
I’ve tried a lot of things like revert, invalidateAllObjects,
dispose (where I get a java.lang.IllegalStateException).
Also increasing the max heap size for the JVM does not help. The
error appears only later.
I’ve used JProfiler to profile the web-service and found the most
(also increasing) memory usage in editingContext
()._initWithParentObjectStore().
I’ve tried this example on a WindowsXP with WebObjects 5.2.4 as
well on a Apple XServe with WebObjects 5.3.
public class MyService implements IMyService {
public void storeToDB(String text1, String text2, String
text3, String text4, String text5) {
WOSession session =
WOWebServiceUtilities.currentWOContext().session();
EOEditingContext ec = session.defaultEditingContext();
//ec.setUndoManager(null);
ec.undoManager().disableUndoRegistration();
MyLog myLog = new MyLog();
myLog.setCol1(text1);
myLog.setCol2(text2);
myLog.setCol3(text3);
myLog.setCol4(text4);
myLog.setCol5(text5);
ec.insertObject(myLog);
ec.saveChanges();
}
}
Any ideas?
Ralf
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
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/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden