# too complicated algebra => memory leak

I don't think it is normal the fact that in my code, if we choose p = 2 (line 9), and if we replace the 6th line of code starting from the end (line 377) with if p! = 127 : (trying so to calculate the limit when p = 2) it crashes my PC (notebook 9.0,UBUNTU 18.04) without generating any error messages !.

PapyFlammy method used in my code

[edited : 2019/01/07 adding content of error message I got following adding the assume cmd]:

GNU nano 2.9.3                                                    /home/ortollj/.sage/crash_logs/crash_nj84d4qw.log

Type "apropos word" to search for commands related to "word".
[New LWP 3329]
[New LWP 3330]
[New LWP 3331]
[New LWP 3332]
[New LWP 3333]
[New LWP 3334]
[New LWP 3335]
[New LWP 3343]
[New LWP 3358]
[New LWP 3359]
[New LWP 3360]
To enable execution of this file add
line to your configuration file "/home/ortollj/.gdbinit".
To completely disable this security protection add
line to your configuration file "/home/ortollj/.gdbinit".
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
0x00007f6fc2a7623a in __waitpid (pid=3529, stat_loc=stat_loc@entry=0x0,
options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30

edit retag close merge delete

When I set a lowish memory limit with your code, I get a rather quick "segmentation fault". It looks like the code gets stuck in the limit computation, which gets done by maxima. The expression that you're taking the limit of is rather awful, so I suspect that maxima is simply running out of memory, trying to expand some horrible expression. The limit you're trying to compute is undoubtably computable, but you may have to go about it a little more carefully.

( 2020-01-07 05:56:03 +0100 )edit
1

Doing assume(k, 'integer') after the declaration of k should give some (not necessarily enough) improvement.

( 2020-01-07 10:02:59 +0100 )edit

Thank you @rburing it is now much better, my PC does not crash anymore with what you recommended:

k=var('k')
assume(k,'integer')
assume(k>=0)


now I got this error message below

30 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory. Traceback (most recent call last): File "<string>", line 25, in <module> ModuleNotFoundError: No module named 'Cython' Error while executing Python code. Saved trace to /home/ortollj/.sage/crash_logs/crash_nj84d4qw.log ------------------------------------------------------------------------ Unhandled SIGSEGV: A segmentation fault occurred. This probably occurred because a compiled module has a bug in it and is not properly wrapped with sig_on(), sig_off(). Python will now terminate.

( 2020-01-07 10:48:47 +0100 )edit

but with assume(k,'integer') the PC does not crash for p=2, and still not able to compute the limit, but it is then no longer able to calculate the limit for p = 3!(which it was able to did without assume(k,'integer'), I got
The kernel appears to have died. It will restart automatically.