too complicated algebra => memory leak

asked 2020-01-06 12:06:24 -0500

ortollj gravatar image

updated 2020-01-07 04:14:00 -0500

Hi my code on SageCell

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

image description

[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]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
To enable execution of this file add
        add-auto-load-safe-path /home/ortollj/Downloads/SageMath/local/lib/libstdc++.so.6.0.27-gdb.py
line to your configuration file "/home/ortollj/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/ortollj/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
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 flag offensive close merge delete

Comments

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.

nbruin gravatar imagenbruin ( 2020-01-06 22:56:03 -0500 )edit
1

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

rburing gravatar imagerburing ( 2020-01-07 03:02:59 -0500 )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.

ortollj gravatar imageortollj ( 2020-01-07 03:48:47 -0500 )edit

@rburing, I should have think about adding assume for k.sorry.

ortollj gravatar imageortollj ( 2020-01-07 03:54:42 -0500 )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.

There is something fishy around here !

ortollj gravatar imageortollj ( 2020-01-07 11:36:07 -0500 )edit