Re:Garbage Collection
by ufo on Sunday December 01, 2019 @06:04AM
(#21674906)
There are some optimizations that do thus. When you know the object won't outlive the function, allocate it on thw stack instead of on the heap
And on the more extreme case you can even replace the objects with a bunch of local variables. For example, replace a Point object allocated on the stack with a pair of variables gor the x and y coordinates.
And on the more extreme case you can even replace the objects with a bunch of local variables. For example, replace a Point object allocated on the stack with a pair of variables gor the x and y coordinates.