Skip to content

Segmentation fault when using memory allocation tracker #4834

@letmaik

Description

@letmaik

I use Python 2.7.6, numpy 1.8.1 and cython 0.20.2 under Red Hat 6.5. I tried out the code in numpy/tools/allocation_tracking, that is, I installed the extension (alloc_hook) and then copied track_allocations.py into my own code and used it according to the example in the main block. But the moment I allocate a numpy array I get a segmentation fault. In case it is related, here is the extension compile output:

(p27)-bash-4.1$ python setup.py install
running install
running build
running build_ext
cythoning alloc_hook.pyx to alloc_hook.c
warning: alloc_hook.pyx:30:18: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
warning: alloc_hook.pyx:30:29: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
building 'alloc_hook' extension
creating build
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/Python2.7/lib/python2.7/site-packages/numpy/core/include -I/opt/Python2.7/include/python2.7 -c alloc_hook.c -o build/temp.linux-x86_64-2.7/alloc_hook.o
In file included from /opt/Python2.7/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761,
                 from /opt/Python2.7/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /opt/Python2.7/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from alloc_hook.c:352:
/opt/Python2.7/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
/opt/Python2.7/lib/python2.7/site-packages/numpy/core/include/numpy/__ufunc_api.h:241: warning: ‘_import_umath’ defined but not used
creating build/lib.linux-x86_64-2.7
gcc -pthread -shared build/temp.linux-x86_64-2.7/alloc_hook.o -L/opt/Python2.7/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/alloc_hook.so
running install_lib
copying build/lib.linux-x86_64-2.7/alloc_hook.so -> ...

@thouis @charris

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions