[New-bugs-announce] [issue30527] PyMemoryView_FromBuffer memory leak

Christoph Reiter report at bugs.python.org
Wed May 31 12:35:05 EDT 2017

New submission from Christoph Reiter:

I'm using the following code

PyObject *
get_memoryview (PyObject *self) {
    Py_buffer view;


    // this takes a ref on self
    if (PyBuffer_FillInfo (&view, self, buffer, length, 0, 0) < 0)
        return NULL;

    // this returns a <memory> object
    return PyMemoryView_FromBuffer (&view);

The problem is that when I call release() on the returned memory object
the buffer does not get release and as a result the exporter leaks.

Am I missing something or is this a bug?

messages: 294851
nosy: lazka
priority: normal
severity: normal
status: open
title: PyMemoryView_FromBuffer memory leak

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list