Which this change, the finalizer is only called once, when there are no more pointers to the object, which is exactly what should happen.
The corruption that occurred before was because `deepcopy` made a new Julia object (without a finalizer), but retaining the pointer to the memory controlled by gmp.
If the original is then GCed, the finalizer gets called, and the copy is left with a dangling pointer, and once that memory gets reallocated and overwritten, then you will start to get
failures in the mpfr code.
If the copy is GCed first, then nothing will happen, the bullet is dodged.
This means that if the old one is finalized the new one is too, which is not what it is supposed to do.
And just to be clear, I mean calling finalize
explicitly.
Not disagreeing.. elaborating about an experimental gc.