[Mono-devel-list] Zero Length Arrays
jeroen at sumatra.nl
Mon Jan 12 05:13:59 EST 2004
Ben Maurer wrote:
> So, today, I realized that there is a VERY simple solution. In
> mono_array_new, if it finds that it will be creating a zero length
> array, it should used a cached zero length array.
"The newarr instruction pushes a reference to a *new* zero-based,
one-dimensional array" (my emphasis).
This optimization is not allowed. Plain and simple.
Piers Haken wrote:
> What about locking?
This is why the optimization isn't legal. The following pattern is
object myLock = new object;
More information about the Mono-devel-list