Skip to content

still rechable memory: various pyx-filesdo not free reference to PariInstance #718

Closed
@sagetrac-mabshoff

Description

@sagetrac-mabshoff

Doing a startup + quit with Sage 2.8.4.2 leads to five of the following:

==8222== 524,288 bytes in 1 blocks are still reachable in loss record 1,983 of 1,998
==8222==    at 0x4A1BB35: malloc (vg_replace_malloc.c:207)
==8222==    by 0xA6F983A: gpmalloc (in /tmp/Work-mabshoff/sage-2.8.4.3.pre-vg/local/lib/libpari-gmp.so.2)
==8222==    by 0xA6FA8DE: pari_init_opts (in /tmp/Work-mabshoff/sage-2.8.4.3.pre-vg/local/lib/libpari-gmp.so.2)
==8222==    by 0xAA74864: __pyx_f_3gen_12PariInstance___init__ (gen.c:20649)
==8222==    by 0x459220: type_call (typeobject.c:436)
==8222==    by 0x415522: PyObject_Call (abstract.c:1860)
==8222==    by 0x47C850: PyEval_CallObjectWithKeywords (ceval.c:3433)
==8222==    by 0xAA76BFE: initgen (gen.c:27873)
==8222==    by 0x49E54D: _PyImport_LoadDynamicModule (importdl.c:53)
==8222==    by 0x49C45D: import_submodule (import.c:2394)
==8222==    by 0x49C920: load_next (import.c:2214)
==8222==    by 0x49CB7D: import_module_level (import.c:2002)

We should only instantiate one pari instance, so the following culprits ought to import the global pari instance:

rings/real_mpfr.pyx:        cdef PariInstance P
rings/real_double.pyx:        cdef sage.libs.pari.gen.PariInstance P = sage.libs.pari.gen.pari
rings/complex_double.pyx:        cdef sage.libs.pari.gen.PariInstance P = sage.libs.pari.gen.pari
rings/complex_double.pyx:        cdef sage.libs.pari.gen.PariInstance P
rings/complex_double.pyx:        cdef sage.libs.pari.gen.PariInstance P

This saves about 2.5 MB of memory.

Cheers,

Michael

Component: memleak

Issue created by migration from https://trac.sagemath.org/ticket/718

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy