Re:Allocation is cheap in .NET until it is not
by aardvark179 on Wednesday January 24, 2018 @04:56PM
(#16226718)
Construction is a two step process. The space for something is allocated and then the constructor is called so there isn’t anything magical in that example.
It does however also remove half the guarantees about uninitiated object visibility in the java memory model because your leaking the reference inside the constructor.
It does however also remove half the guarantees about uninitiated object visibility in the java memory model because your leaking the reference inside the constructor.