Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when returning numpy arrays #47

Open
mferrero opened this issue Feb 26, 2023 · 0 comments
Open

Memory leak when returning numpy arrays #47

mferrero opened this issue Feb 26, 2023 · 0 comments

Comments

@mferrero
Copy link
Member

When numpy arrays are returned, a small amount of memory leaks. This amount of memory (I think it is 32 bytes) does not depends on the actual size of the array that is returned, so it is probably related to some object that is created while preparing the numpy array. The following code produces a leak

from triqs.gf import *

g = GfImFreq(indices = [0], beta=10, n_points=1000)
#g = GfImFreq(target_shape = [], beta=10, n_points=1000) ## no memory leak with this
# memory usage here is about 42 Mb

for k in range(10000000): x = g(1)
# memory usage here is about 350 Mb

In the code above, the memory usage is about 300 Mb larger after the loop. Similar behavior is observed calling other functions that return an array. I don't see leaks when the functions return a float.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant