root
root copied to clipboard
Python Interface: assigning a numpy array to a std vector leaks memory
Check duplicate issues.
- [ ] Checked for duplicates
Description
Assigning a numpy array to a std vector leaks memory. The attached script starts with 600 MB memory use and quickly goes into GBs. The commented-out vector::clear() does not help.
Reproducer
#!/usr/bin/python
import numpy as np
import ROOT
v = ROOT.vector["vector<vector<int>>"]()
a = np.arange(100**3, dtype=np.int32).reshape(100,100,100)
for i in range(10000):
#v.clear()
v += a
ROOT version
heads/master@v6-37-01-6541-g9a9e7697e4
Installation method
Source
Operating system
Linux
Additional context
No response