coldfusion.util.Key Memory Leak - Issue with Structure Keys?

Consistently, I am able to generate a Java Heap Space OutOfMemory exception with the following code on ColdFusion 9.01 (haven't tried earlier versions):

<cfset uuidGenerator = createObject("java", "java.util.UUID")>
<cfset transient = structNew()>
<cfloop from="1" to="100000" index="index">
    <cfset transient[uuidGenerator.randomUUID().toString()] = true>
</cfloop>

The code above uses the Java UUID class because its faster than ColdFusion's. The structure itself does not exist after the request (i.e. it's not in some persistent scope such as application).

As a test, I generate a heap dump just after initializing the server. Then I run this code several times and see the tenured generation fill through jConsole. After, I run another heap dump. Using Eclipse Memory Analysis Tool's Leak report I can see one large object rooted on coldfusion.util.Key.

I'm asking here in hopes others have hit similar problem, and if so, what they've done to work around it.

5
задан orangepips 5 May 2011 в 13:15
поделиться