Re: Patch: support callback on allocation overflow instead of calling abort()

2020-10-07 Thread Colin Caine
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

Re: Patch: support callback on allocation overflow instead of calling abort()

2020-10-07 Thread Colin Caine
Hi Niels, This sounds hopeful! > To make any progress with adding a callback like this, we'd need to > either: > > 1. Find out and document how to longjmp out from the callback safely. > > 2. Agree and document that when GMP invokes this callback, GMP state > should be considered invalid. The

Re: Patch: support callback on allocation overflow instead of calling abort()

2020-10-06 Thread Vincent Lefevre
On 2020-10-06 16:59:10 +0200, Niels Möller wrote: > There are other approaches to avoid these crashes, e.g., I think the > recent emacs integration uses a (configurable) limit on bignum size, and > will raise an emacs exception long before hitting GMP's limits, and the > emacs process can go on

Re: Patch: support callback on allocation overflow instead of calling abort()

2020-10-06 Thread Niels Möller
Colin Caine writes: > Sorry, this patch was posted to this list last month, but I didn't see it > in the archives. See here for related discussion: > https://gmplib.org/list-archives/gmp-bugs/2020-September/004865.html I asked some questions (some off list), and haven't seen satisfactory

Re: Patch: support callback on allocation overflow instead of calling abort()

2020-10-06 Thread Marc Glisse
On Tue, 6 Oct 2020, Vincent Lefevre wrote: On 2020-10-06 11:51:29 +0200, Marc Glisse wrote: On Tue, 6 Oct 2020, Vincent Lefevre wrote: On 2020-10-06 04:41:42 +0100, Colin Caine wrote: This is used by Julia to raise an OutOfMemory exception rather than having the Julia process itself abort.

Re: Patch: support callback on allocation overflow instead of calling abort()

2020-10-06 Thread Colin Caine
Sorry, this patch was posted to this list last month, but I didn't see it in the archives. See here for related discussion: https://gmplib.org/list-archives/gmp-bugs/2020-September/004865.html Though this discussion chain about memory leaks is new :) It's worth noting that this patch is useful

Re: Patch: support callback on allocation overflow instead of calling abort()

2020-10-06 Thread Vincent Lefevre
On 2020-10-06 11:51:29 +0200, Marc Glisse wrote: > On Tue, 6 Oct 2020, Vincent Lefevre wrote: > > > On 2020-10-06 04:41:42 +0100, Colin Caine wrote: > > > This is used by Julia to raise an OutOfMemory exception rather than having > > > the Julia process itself abort. > > > > > > Others on

Re: Patch: support callback on allocation overflow instead of calling abort()

2020-10-06 Thread Vincent Lefevre
On 2020-10-06 04:41:42 +0100, Colin Caine wrote: > This is used by Julia to raise an OutOfMemory exception rather than having > the Julia process itself abort. > > Others on stackoverflow, etc, have experienced similar problems with > undesired aborts(), so this patch would probably be useful to

Patch: support callback on allocation overflow instead of calling abort()

2020-10-06 Thread Colin Caine
This is used by Julia to raise an OutOfMemory exception rather than having the Julia process itself abort. Others on stackoverflow, etc, have experienced similar problems with undesired aborts(), so this patch would probably be useful to a variety of users. (see: