Re: diagnosing memory consumption and optimization
Re: diagnosing memory consumption and optimization
- Subject: Re: diagnosing memory consumption and optimization
- From: Rob Lockstone <email@hidden>
- Date: Wed, 24 Mar 2004 17:05:32 -0800
Perhaps a third party tool like JProfiler
<http://www.ej-technologies.com/index.html> or OptimizeIt
<http://www.borland.com/optimizeit/>?
Rob
On Mar 24, 2004, at 16:45, Jonathan Rochkind wrote:
My app is set to catch an OutOfMemoryError (or an NSForwardException
wrapping one) in WOApplication.handleException(), and just terminate
the app in response (it's too hard to recover from, at that level).
Then wotaskd will restart it.
I keep raising and raising the Java heap allocation, but the apps
keeping dying with an OutOfMemory. I can't figure out why. But I
recently added something so the app prints
Runtime.getRuntime().totalMemory() and
Runtime.getRuntime().freeMemory() before it does. (What's the
difference between totalMemory() and maxMemory() anyway?)
But I'm getting output in the logs that looks like this:
[2004-03-24 12:12:38 CST] <WorkerThread10> Total memory of Runtime:
200540160
[2004-03-24 12:12:38 CST] <WorkerThread10> Free memory of Runtime:
8185816
Hmm, if there's still 8 megs of free memory---then why is the thing
dying with OutOfMemory? Well, maybe the operation that threw the
OutOfMemoryError in the first place was using these 8 megs, which
could be GC'd after the operation threw an exception and ended. But 8
megs still seems rather large.
So the larger question is: If my OutOfMemory is just due to lots of
WOSessions holding lots of WOComponents in the cache and lots of
snapshots and EOs and such----okay, that just means I need to keep
giving it more memory.
But what if instead there's one particular task in my app that demands
a huge amount of memory to complete the task, and then gives it up
when complete---well, that would be a key point for memory
optimization, seems to me. Or, for that matter, that would be some
code that's likely to be really poorly written and should be fixed
(there are no tasks in my app I can think of in my app that should
demand lots of memory).
How do I tell the difference between these scenarios? If there is one
particular piece of code that's a memory hog, how do I identify it?
It's a large and complex app, so it needs to be something I can apply
to the app actually in use, actually deployed, since my attempts to
test it offline may not match the real world usage.
Any suggestions? Memory optimization or tuning is not something I
know anything about.
--Jonathan
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.