Open b0bleet opened 2 years ago
Following, as I'm having a similar issue. Using pybind11 v2.5.0, just by
I get a
free() invalid pointer
after deallocation, and debugging that seems to be triggered when deleting a key string in the internals::shared_data
unordered_map (value of the string seems to be "_life_support")
I thought it was something within the particular module I was importing, but this makes me believe it's something within pybind11
EDIT:
I get the free(): invalid pointer
error importing either scipy.signal
or sklearn
. Most other modules are fine
# These are fine
import numpy as np
import math
import copy
import logging
import yaml
from pickle import dump, load
from os.path import join, isfile
from collections import deque, Counter
from random import seed
# Any of these triggers the segfault
# from scipy.signal import butter, lfilter
# from scipy.stats import iqr, linregress
# from scipy.signal import find_peaks
# from sklearn.tree import DecisionTreeClassifier
# from sklearn.ensemble import RandomForestClassifier
# from sklearn import preprocessing, metrics
Required prerequisites
Problem description
Hi, ASAN reports that https://github.com/pybind/pybind11/blob/6493f496e30c80f004772c906370c8f4db94b6ec/include/pybind11/detail/internals.h#L498-L508 allocated ptr variable in internals.h:504 is not deallocated properly when calling finalize_interpreter few times. ASAN report:
Reproducible example code