Earlier quoted context omitted.
(a bit of topic - but I'm humbly trying to learn more...) I've got zero experience writing allocators. Is there some common ones you use provided somewhere? Do you write your own? (in which case can you point me to where to learn to do that properly)
I don't write allocators myself, but Boost has a pool allocator library [ http://www.boost.org/doc/libs/1_60_0/libs/pool/doc/html/inde... ], which conforms to the Allocator concept defined in the standard library [ http://en.cppreference.com/w/cpp/concept/Allocator ].
Collections-C, generic data structures for C
61–63 of 63 posts
Re: Collections-C, generic data structures for C
#62Earlier quoted context omitted.
But for this kind of application, wouldn't you just panic and do a soft restart on malloc failure anyway? Actually recovering from an out-of-memory situation is incredibly fraught and unreliable; most of the realtime operating systems I've used don't even bother to try.
That depends on when a failure were to occur. If we have a failure while the spacecraft is en route to its destination, perhaps we can recover because we may have enough time. If we have a failure during rendezvous with our target, it could be a very bad day.
You always need to be able to recover from a soft reboot, even during maneuvers; you're in a high radiation environment and any passing high energy particle or cosmic ray can trigger this.
Re: Collections-C, generic data structures for C
#63I try and plug http://concurrencykit.org/ whenever I see someone looking for something like this. It's built around providing portable atomic intrinsics for parallel code, but the data structures are also very well done and work just as nicely for single threaded code.