Reputation: 199
Good Day,
I was wondering if it was possible to view/debug/hack into the coldfusion.runtime source code.
Specifically, I'm getting out of memory errors that look like the following:
allocLargeObjectOrArray: [C, size 8388624
java.lang.OutOfMemoryError: allocLargeObjectOrArray: [C, size 8388624 at
java.util.Arrays.copyOf(Arrays.java:2882) at
java.io.CharArrayWriter.write(CharArrayWriter.java:105) at
coldfusion.runtime.CharBuffer.replace(CharBuffer.java:37) at
coldfusion.runtime.CharBuffer.replace(CharBuffer.java:50) at
coldfusion.runtime.NeoBodyContent.write(NeoBodyContent.java:254) at
[My Code]
I would like to know what the CharBuffer is replacing and why, what array it is copying and why, etc., so that I can tune my code.
My code cfloop's through a query and outputs its fields, including an 'IIf' statement and a 'de' function call.
I'm aware that I could tinker around with the code, and wait for it to crash again (or not), but I would prefer to see exactly what the problem is, rather than use trial and error.
Thank you.
Upvotes: 0
Views: 774
Reputation: 229
Get a free Java decompiler: http://jd.benow.ca/.
Search for the cfusion.jar
file in your ColdFusion install directory.
Open it with the decompiler. CharBuffer
should be in there.
Upvotes: 3
Reputation: 199
In the end it simply comes down to how Coldfusion buffers its pages.
It manages its own implementation of a java.io.CharArrayWriter, and see line 88 where it will double the size of the char[] whenever it gets full.
Seems reasonable to me. But some of our pages are quite large, and 8mb * 20 concurrent page requests means a lot of RAM activity.
I'll just have to work on reducing the size of our pages...
Upvotes: 1
Reputation: 5678
The first option is to set HeapDumpOnOutOfMemoryError and then open the dump in JHAT to look for what is taking up the space. Given that the erroring code is attempting to copy a large buffer, there should be one already in memory. That ought to point you in the direction of the error
You can almost certainly do the following, though if you want to:
That ought to get you the ability to halt the thread as it errors and inspect the variables. Something in your code looks to be creating an 8.3 meg string. Being able to inspect the memory would probably help a lot.
Upvotes: 4