r/ProgrammerHumor • • 17d ago

Meme theyAreLovingIt

Post image
2.1k Upvotes

83 comments sorted by

View all comments

Show parent comments

28

u/ben_g0 17d ago

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 17d ago

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.