Memory Allocation Strategies

Discussions revolve around the performance costs of heap allocations, garbage collection pauses, and alternatives like arenas, stack allocation, object pools, and manual management in languages such as Rust, C++, Java, and Go.

➡️ Stable 0.6x Programming Languages
5,237
Comments
20
Years Active
5
Top Authors
#8557
Topic ID

Activity Over Time

2007
3
2008
9
2009
30
2010
50
2011
80
2012
109
2013
162
2014
270
2015
257
2016
372
2017
321
2018
287
2019
304
2020
443
2021
462
2022
542
2023
508
2024
449
2025
542
2026
39

Keywords

GC psu.edu rfleury.com OK KB citeseerx.ist JavaScript FlatBuffers allocation gc heap allocations memory allocator allocated allocating arena stack

Sample Comments

michielderhaeg Feb 7, 2025 View on HN

You can make your allocations faster if you don't have to worry about deallocation. Could be a performance thing.

Capricorn2481 Apr 1, 2025 View on HN

Aren't allocations themselves pretty expensive regardless of GC?

birdsbolt Aug 14, 2015 View on HN

Allocations don't have to be expensive if your GC is smart. Smart as C++ destructors positioning :D

throwaway2037 Jul 9, 2024 View on HN

In my experience: Allocation is OK, but garbage collection is bad.

trumpsamerica Jan 14, 2018 View on HN

Garbage collected allocation is coming. There's even an rfc I think. Manishearth is working gon it

ykonstant Jul 4, 2024 View on HN

The lack of heap allocations is great! Thanks for the pointers.

Contemporary allocators make allocation cheap. Not sure how GC is any better at fragmentation.

mbq Jan 10, 2013 View on HN

I bet in 99% of cases using such structure is a nonsense overhead, and in 85% the code relaying on it can be written without a single heap allocation.

speed_spread Nov 28, 2024 View on HN

Doesn't dynamic allocation expose you to memory fragmentation or other non-deterministic phenomenons?

evnn Mar 3, 2018 View on HN

Garbage collection vs stack allocation