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 on index access #237

Open
EmptySpace99 opened this issue Feb 29, 2024 · 0 comments
Open

Memory leak on index access #237

EmptySpace99 opened this issue Feb 29, 2024 · 0 comments

Comments

@EmptySpace99
Copy link

EmptySpace99 commented Feb 29, 2024

The memory allocated when an index is opened is not correctly released, in fact when the index is opened and closed multiple times you can notice the memory increase. Does anyone have any idea how to solve this?

How to reproduce

Create and store my index

grib_path = "..."
index_path = "..."
index = pygrib.index(grib_path, 'shortName')
index.write(index_path)
index.close()

Access to the index

index = pygrib.index(index_path)
index.select(shortName='u') # Allocates memory
index.close() # Closed index but memory is not released (easily checkable using a memory profiler)

Memory profiler

Line #    Mem usage    Increment  Occurrences   Line Contents
=============================================================
233    231.4 MiB    231.4 MiB           1       @profile   
234                                             def test(self, index_path: str, short_name: str):
235    232.0 MiB      0.6 MiB           1           index = pygrib.index(index_path)
236    356.9 MiB    124.9 MiB           1           index.select(shortName=short_name)
237    356.9 MiB      0.0 MiB           1           index.close()
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