On Oct 19, 2010, at 10:53 AM, Ricardo J. Parada wrote: > Hi All, > > I have log4j configured to email on errors and include the free memory. > Here's one example on a GUI-less app which generates reports. > > 910.25 MB total/761.92 MB used/148.33 MB free > > [performWork] > > (com.mpv.eoaccesscontrol.MPVLog, error, MPVLog.java:116) - > > java.lang.OutOfMemoryError: Java heap space > at > java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:99) > at > java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:393) > at java.lang.StringBuffer.append(StringBuffer.java:225) > at > com.mpv.reports.AdHocReportExporter.exportValue(AdHocReportExporter.java:482) > at > com.mpv.reports.AdHocReportExporter.exportRecordColumns(AdHocReportExporter.java:419) > at > com.mpv.reports.AdHocReportExporter.exportRecords(AdHocReportExporter.java:351) > at > com.mpv.reports.AdHocReportExporter.export(AdHocReportExporter.java:132) > ... > at er.extensions.concurrency.ERXTimerTask.run(ERXTimerTask.java:25) > at java.util.TimerThread.mainLoop(Timer.java:512) > at java.util.TimerThread.run(Timer.java:462) > > My first question is: how come that there are 148MB of free memory but the > error logged says that the app ran out of memory. My guess is that yes, it > did run out of memory but by the time the exception was logged the garbage > collector was able to free up memory. Could that be the case?
Yes.
> Here's the relevant property that is responsible for putting the memory stats
> in the error logged:
>
> # email is an SMTPAppender
> ...
> log4j.appender.email.layout.ConversionPattern=[${MPVAgentName}] %r %-5p
> %d{ISO8601}%n%n%V{t total/u used/f free}%n%n[%t] %n%n (%C, %M, %F:%L) -
> %n%n%m%n
>
> My second question is: how come the total memory is 910.25MB if the app is
> running with -Xmx1024MB ?
I am not sure where those numbers come from. It might be JVM overhead or the
memory the classes are loaded into.
Chuck
--
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/products/practical_webobjects
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
