3 ms·
You're not going to segfault either way, especially if you're a library. If you're a library then when the API user creates your context, if possible, you shoul
by AndyKelley 11y ago
You're not going to segfault either way, especially if you're a library. If you're a library then when the API user creates your context, if possible, you should preallocate all the memory you're going to use, and if that fails, report the error. If preallocation is not possible then, as a library, it is your duty to report memory allocation errors just as you would any other error, ideally as a return code.