boostorg / boostorg/python

About the reference count of python-side returned objects

Offen
#220 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
537
Forks
223
Ø Merge
11 Std. 22 Min.
Gemergte PRs (30 T.)
2

Beschreibung

Hi there, if I use boost_python to call a python side function and get a boost::python::object return, it seems that the reference count of wrapped obj.ptr() is at least 1 as they are set to one when created. But I don't think the reference count will be reduced automatically when boost::python::object is destructed (please correct me if I am wrong). If so, how can this memory be freed, should we manually decrease the reference count so that python GC can work? This is especially important if a large object like numpy::ndarray if returned, I am not sure whether C-side or Py-side should take charge of freeing the memory. Thanks in advance!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.