Memory allocation is slow and undeterministic in perf. Some allocations also require a global lock on the system level. It’s also a point of failure if the allocation doesn’t succeed, so there’s an extra check somewhere.
Furthermore if every object is a pointer you get indirection overhead (even though small but existent).
Deallocation as well incurs an overhead.
Without a compacting gc you run into memory fragmentation which further aggravate the issue.
All of this overhead can be felt in tight loops.
anonymousdang|1 year ago
[deleted]