Patch: support callback on allocation overflow instead of calling abort()
cmcaine at gmail.com
Tue Oct 6 15:03:16 UTC 2020
I agree with what I think Marc is suggesting, that we can get a good solution
here without accounting for all (or perhaps any) memory leaks.
The Julia project doesn't really care about memory leaks in this context anyway.
Here's a comment by one of the language designers, Stefan Karpinski (they're not
subscribed to this list):
>> Since the function could have allocated memory for intermediate computations,
>> how do you avoid memory leaks?
> Not much you can do: chances are if you get to the point of OOMing, the
> process is going to crash, we just want the ability to do it more gracefully
> than a C abort call, which is something that a library should really never do.
> If GMP wants to be super careful, it could free anything that was allocated
> before returning an error, but it would also be fine to document that when an
> OOM error is returned some allocated memory may be lost.
More information about the gmp-bugs