Hacker News new | ask | show | jobs
by monocasa 2803 days ago
Nah, you can still call malloc/new. Worked on a sweet RTOS that had tons of default overrides for new that ultimately let you define all layout from your top level module despite following these guidelines. Let you share tons of code across boards, but still make decisions like "this guy's buffers should be this big, and stored in this ram bank" all from the top level C++ file for each board.

And it's definitely not stack allocated like the original point of this thread.

1 comments

Well but regardless, if you have a malloc or new implementation that uses a static buffer, then you're still not touching the heap. In fairness and as you point out, it's not the stack either, but they're obviously not letting stack allocations escape. Nothing would ever work.
> Well but regardless, if you have a malloc or new implementation that uses a static buffer, then you're still not touching the heap.

What do you think the heap is on systems without an MMU?

> In fairness and as you point out, it's not the stack either, but they're obviously not letting stack allocations escape. Nothing would ever work.

You can go for an awfully long time without knowing that you dangling pointers to auto allocated objects.