I don't have anything helpful to add but here is something I just ran into 
(with version 10.2).  Here, E = EllipticCurve('162a1') -- but rerunning in 
a fresh Sage did not trigger the error.   The number of bytes in the second 
line is rather more than my laptop has, I think (and pari.stacksize() is 
onlu 8000000).

sage: [E.reduction(p).abelian_group().invariants() for p in 
primes_first_n(50) if p%4==1 and p>3]
/usr/lib/python3.10/inspect.py:3186: RuntimeWarning: cypari2 leaked 
140516603778792 bytes on the PARI stack
  return self._bind(args, kwargs)
ERROR: removing wrong instance of Gen
Expected: [Mod(1, 173), Mod(172, 173), Mod(0, 173), Mod(167, 173), Mod(8, 
173), Mod(170, 173), Mod(161, 173), Mod(32, 173), Mod(113, 173), Mod(124, 
173), Mod(120, 173), Mod(25, 173), Mod(55, 173), Vecsmall([3]), [173, [112, 
94, [6, 164, 3, 0]]], [177, [[177], 1], [[Mod(146, 173), Mod(122, 173)]], 
[177, [3, 1; 59, 1]]]]
Actual:   [Mod(1, 113), Mod(112, 113), Mod(0, 113), Mod(107, 113), Mod(8, 
113), Mod(110, 113), Mod(101, 113), Mod(32, 113), Mod(53, 113), Mod(71, 
113), Mod(61, 113), Mod(22, 113), Mod(84, 113), Vecsmall([3]), [113, [4, 
96, [6, 104, 3, 0]]], [129, [[129], 1], [[Mod(21, 113), Mod(32, 113)]], 
[129, [3, 1; 43, 1]]]]
ERROR: inconsistent avma when removing Gen from PARI stack
Expected: 0x7fcc924092a8
Actual:   0x7fcc9240d190
ERROR: removing wrong instance of Gen
Expected: [Mod(1, 109), Mod(108, 109), Mod(0, 109), Mod(103, 109), Mod(8, 
109), Mod(106, 109), Mod(97, 109), Mod(32, 109), Mod(49, 109), Mod(79, 
109), Mod(79, 109), Mod(27, 109), Mod(90, 109), Vecsmall([3]), [109, [47, 
94, [6, 100, 3, 0]]], [99, [[33, 3], 3], [[Mod(30, 109), Mod(35, 109)], 
[Mod(91, 109), Mod(3, 109)]], [33, [3, 1; 11, 1]]]]
Actual:   [Mod(1, 173), Mod(172, 173), Mod(0, 173), Mod(167, 173), Mod(8, 
173), Mod(170, 173), Mod(161, 173), Mod(32, 173), Mod(113, 173), Mod(124, 
173), Mod(120, 173), Mod(25, 173), Mod(55, 173), Vecsmall([3]), [173, [112, 
94, [6, 164, 3, 0]]], [177, [[177], 1], [[Mod(146, 173), Mod(122, 173)]], 
[177, [3, 1; 59, 1]]]]
/usr/local/sage/sage-10.2/src/sage/schemes/curves/projective_curve.py:221: 
RuntimeWarning: cypari2 leaked 14760 bytes on the PARI stack
  Curve_generic.__init__(self, A, X)

On Tuesday 17 September 2024 at 16:40:16 UTC+1 Nils Bruin wrote:

> On Tuesday 17 September 2024 at 07:04:18 UTC-7 dim...@gmail.com wrote:
>
>
> that's the legacy of developing software in a platform-independent 
> machine assembly language 
> known as C or C++, or Fortran :-) 
> Then, as we know, Greenspun's tenth rule states that: 
>
> Any sufficiently complicated C or Fortran program contains an ad hoc, 
> informally-specified, bug-ridden, slow implementation of half of 
> Common Lisp. 
>
>
> That's not actually the kind of bug I was thinking of. The memory leaks 
> that have been particularly hard to find in sage were on python/cython 
> level, which are generally memory-safe languages. They are about how to 
> handle the essentially global data structure that arises from the coercion 
> framework.
>
> For instance, if you'd store on ZZ the coercion maps to any ring in the 
> normal way, every ring now has a reference from an object that will never 
> be garbage collected (ZZ) and hence will not be eligible for collection 
> either. Sage doesn't do that, of course, but the coercion graph does need 
> to hold this information somehow. Doing that in a way that still allows 
> parts to be pruned once some objects are not referenced very much anymore 
> is truly a delicate problem. The globally unique "UniqueParent"s are 
> another example of such a hard-to-manage global data structure, where 
> garbage removal is very delicate. From python's (or common lisp's) 
> perspective these wouldn't be memory leaks: they are just globally 
> accessible structures ineligible for collection.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/e994c090-7250-40f3-84ac-c2f1a85ccc9bn%40googlegroups.com.

Reply via email to