4 ms·
GC does force you into a memory layout for your objects that negates any advantage in the allocation routines proper.
by andrepd 2y ago
GC does force you into a memory layout for your objects that negates any advantage in the allocation routines proper.
- quotemstr 2y agoNo it doesn't. GCs need to be able to traverse objects. They don't impose object layout constraints.
- tsimionescu 2y agoI'm guessing you're referring to the fact that the most popular GC languages allocate almost every object on the heap, even when used as a field of another object. This is by no means a constraint of the GC, it is a separate design choice. And in fact C# has always supported "value objects", which do get allocated in-place, Java is adding the same support probably in the next release, and Go actually defaults to it.
- pjmlp 2y agoOnly if speaking about languages without system programing capabilities alongside their GC features.