issues: 2162954553
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2162954553 | I_kwDOAMm_X86A7BE5 | 8800 | unload python object from memory | 14925067 | closed | 0 | 5 | 2024-03-01T09:14:30Z | 2024-03-11T14:38:16Z | 2024-03-11T14:38:15Z | NONE | Is your feature request related to a problem?The problem related to the feature I am looking for is the fact that Describe the solution you'd likeI would like that such snippet gives constant memory footprint: ```python import xarray as xr import numpy as np import psutil import os n_iteration = 20 x = np.arange(6000) y = np.arange(3000) ds = xr.Dataset() def get_memory(): pid = os.getpid() python_process = psutil.Process(pid) memoryUse = ( python_process.memory_info()[0] / 2.0 ** 30 ) # memory use in GB...I think print("memory use:", memoryUse) for n in range(n_iteration): matrix_numpy = np.random.rand(y.size,x.size) ds['var'+str(n)] = xr.DataArray(matrix_numpy,dims=['y','x'],coords={'x':x,'y':y}) # here I don't need this matrix anymore, I just want it to be stored in the xr.Dataset del matrix_numpy # I suppose that the memory should be free, but obviously not... get_memory() print(ds) ``` currently the memory footprint is growing at each iteration:
Describe alternatives you've consideredNo response Additional contextcontext:xarray==2023.11.0 ubuntu 22.04 execution in python (not ipython not notebook) |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8800/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |