by methehack · 13y ago · 0 comments
The only possible explanation is that the JIT decided to reorder the execution so the variable was set to memory allocated for the object, and then ran the objects constructor.
It's all very surprising behavior.
That's not to say another concurrent access can't sneak in between the block and the next statement, of course, but it does change the behaviour somewhat. But I can't really think of a use case.
As a side effect, it may also act as a memory barrier.