Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging a Java bus error



Depending on what you're doing, java image processing may take significant non-java-heap memory resources. The phrase, "lots of RAM", is not as descriptive as you think. However, when running 32-bit Java, it doesn't matter very much how much RAM your total system has because the maximum addressable space of your java process is going to be 2G. That 2G of RAM is the limit for the java heap that you allocate combined with any non-java-heap memory that your program uses.

In general, the amount of non-java-heap memory used by java programs is relatively small. But not all java programs are "general". In my experience, two examples of potential big drains on this memory pool are threads (especially threads with large stack sizes that don't need large stack sizes) and image processing.

You say you're allocating a maximum 1500M java heap. But it looks like you're not even getting close to that figure from the Full GC info you provided. In fact, the java heap is actually jumping *down* in size, which is something I haven't seen before. But it would seem to indicate that it's attempting to give up java heap memory for other non-java-heap activities (most likely the image processing is my guess).

I'd try significantly *decreasing* the maximum size of the java heap. But if that does help, I'm guessing it won't be enough. You might need to re-examine how you're doing the image processing and put some kind of cap on how many simultaneous images you're processing, or how large you allow the images to be, or something along those lines.

If you're spawning a lot of threads simultaneously that are not being used by highly recursive operations, you can also look into reducing the thread stack size via the -Xss argument (or re-architecting how you're using threads).

Rob

On Sep 22, 2008, at 11:40, Bill Janssen wrote:

I'm running an image-processing program on OS X 10.5.4 on Intel (Core 2
Duo), Java 5, 32-bit client JVM, with lots of RAM, and am getting a bus
error from Java. Here's the end of a log file that shows -verbose:gc
along with the stack trace:


01182-46-8970-879: 67 milliseconds/page
[GC 396595K->393927K(470824K), 0.0030873 secs]
[Full GC[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor664]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor662]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor665]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor663]
393927K->687K(470824K), 0.0235934 secs]
[Full GC 394422K->587K(470824K), 0.0202323 secs]
[Full GC 587K->587K(423964K), 0.0201229 secs]
[Full GC 587K->587K(255240K), 0.0199182 secs]
[GC 596K->587K(2536K), 0.0020820 secs]
[Full GC 587K->586K(2536K), 0.0200448 secs]
[GC 262730K->262730K(264684K), 0.0027298 secs]
[Full GC 262730K->262730K(264684K), 0.0206568 secs]
[Full GC 394321K->587K(470784K), 0.0215228 secs]
[Full GC 587K->587K(470784K), 0.0196989 secs]
[Full GC 587K->587K(423928K), 0.0216666 secs]
[GC 868K->610K(255220K), 0.0021186 secs]
[Full GC 610K->610K(255220K), 0.0198896 secs]
[GC 262754K->262754K(264760K), 0.0027557 secs]
[Full GC 262754K->262754K(264760K), 0.0221634 secs]
java(69146,0xb0801000) malloc: *** mmap(size=33660928) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Invalid memory access of location 00000018 eip=6a5655a2


I've run this under gdb, but there are no symbols in the Apple Java, so
the trace is pretty much uninformative. I'm looking for tips and tricks
for finding out what's causing this. I'm running with -Xmx1500m, as well.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: how to read images fast with Apple Java? (From: Greg Guerin <email@hidden>)
 >Debugging a Java bus error (From: Bill Janssen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.