r/ProgrammerHumor • • Oct 10 '26

Meme theyAreLovingIt

Post image
2.1k Upvotes

83 comments sorted by

View all comments

Show parent comment

54

u/WriterPlastic9350 Oct 10 '26

Real Programmers manually allocate all their memory ahead of time. :^)

(technically I suppose there's nothing stopping you doing this with your own implementation of malloc)

28

u/ben_g0 Oct 10 '26

That's actually a thing on real-time and/or latency-sensitive applications. Malloc has an unbounded worst-case execution time, which is fundamentally incompatible with real-time design and can also cause jitter.

So in those systems, you either use only static memory and stack allocations, or indeed allocate a large enough pool what you might need ahead of time and use a memory manager that does follow your timings to manage memory within it.

8

u/drivingagermanwhip Oct 10 '26

I've been doing realtime embedded c for over a decade and have never used malloc. It's what I was taught and at this point I'd be too scared to start.

3

u/ilnarildarovuch Oct 10 '26

jemalloc is da best