Jeroen Frijters wrote:
Ian Rogers wrote:
the attached patch modifies ThreadLocal to use an array of Objects hung
off Thread rather than a weak hash map hung off Thread. On DaCapo's
Jython benchmark this can improve the performance of the Jikes RVM by
more than 10%. It also improves other DaCapo benchmark performance. GCJ
already has a similar mechanism to use pthread thread locals.

This patch looks wrong to me:

1) Values are strongly reachable, which means they potentially won't be garbage 
collected.
2) Value slots are reused without clearing them, which means potential security 
hole.

Regards,
Jeroen

Thanks Jeroen,

you're of course right. Without reinventing extra indirections in the locals it strikes me that the easiest way to solve these problems is with a finalizer (groan) in the thread local that iterates over every thread reverting the slot location to the sentinel value. I'll test and revise the patch.

Regards,
Ian

Reply via email to