PengZheng opened a new issue #393: URL: https://github.com/apache/celix/issues/393
As discussed in https://github.com/apache/celix/pull/392#discussion_r790315940, Celix currently assumes that malloc/calloc always succeeds. Rust standard library makes similar assumption, i.e. , memory allocation failure causes direct abort(). However, as far as I know, malloc/calloc can fail on Linux: - overcommit can be turned off - ulimit setting - calloc returns NULL when integer overflow (nmemb * size) is detected in [glibc](https://github.com/lattera/glibc/blob/master/malloc/malloc.c#L3361-L3370) @pnoltes asks me for an effective way of testing malloc/calloc failure so that unit testing can cover such corner cases. My answer is summarized in [ Malloc/Calloc failure emulation playing nicely with Google Address Sanitizer ](https://gist.github.com/PengZheng/9a5117dc93dc1403c170c2ce39ecb5a7). More general whitebox unit testing and its tradeoff is discussed in https://github.com/apache/celix/pull/392#discussion_r791780927. The suggested testing strategy is battle-tested in my day-time job, monitoring a 1MLOC C/C++ codebase. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
