3 ms·
For embedded systems I mostly go with "dynamic memory allocation of any kind is evil" and that solves a lot of issues already. You can still overwrite memory b
by raxxorrax 8y ago
For embedded systems I mostly go with "dynamic memory allocation of any kind is evil" and that solves a lot of issues already.
You can still overwrite memory but it suddenly became much less likely.
- maccard 8y agoThat only eliminates a certain case of bugs. There are still plenty of foot-shotguns available - memcpy/memset, strlen, gets/puts, printf, any file IO, networking calls, etc.
- vardump 8y ago> For embedded systems I mostly go with "dynamic memory allocation of any kind is evil" and that solves a lot of issues already. Yeah, bare metal systems often don't allocate at all. Although one sin they often do commit is using same buffer for multiple purposes. What could go wrong... Perhaps even more common is allocating a buffer on stack and writing past bounds somehow. Also DMA to/from stack is usually not a great idea... Above things sound dumb, but can easily happen when you build your abstraction layers and use them carelessly.
- MrBuddyCasino 8y ago> DMA to/from stack wait what oh my god