• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
diagnosing memory consumption and optimization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

diagnosing memory consumption and optimization


  • Subject: diagnosing memory consumption and optimization
  • From: Jonathan Rochkind <email@hidden>
  • Date: Wed, 24 Mar 2004 18:45:43 -0600

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.


  • Follow-Ups:
    • Re: diagnosing memory consumption and optimization
      • From: Rob Lockstone <email@hidden>
  • Prev by Date: Re: Off Topic : XCode, Java and Code Completion
  • Next by Date: Re: App hangs on 1st access to DB
  • Previous by thread: Creating a dynamic site in WebObjects
  • Next by thread: Re: diagnosing memory consumption and optimization
  • Index(es):
    • Date
    • Thread