home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1366545996

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/7404#issuecomment-1366545996 https://api.github.com/repos/pydata/xarray/issues/7404 1366545996 IC_kwDOAMm_X85Rc9ZM 14808389 2022-12-28T10:28:22Z 2022-12-28T10:28:22Z MEMBER

I'm not sure how memory_profiler calculates the memory usage, but I suspect that this happens because python's garbage collector does not have to run immediately after the del.

Can you try manually triggering the garbage collector? ```python import gc import os import psutil import xarray as xr from memory_profiler import profile

@profile def main(): path = 'ECMWF_ERA-40_subset.nc' gc.collect() print(f"Before opening file: {psutil.Process(os.getpid()).memory_info().rss / 1024 ** 2} MiB") ds = xr.open_dataset(path) del ds gc.collect() print(f"After opening file: {psutil.Process(os.getpid()).memory_info().rss / 1024 ** 2} MiB")

if name == 'main': print(f"Start: {psutil.Process(os.getpid()).memory_info().rss / 1024 ** 2} MiB") main() print(f"End: {psutil.Process(os.getpid()).memory_info().rss / 1024 ** 2} MiB") ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1512460818
Powered by Datasette · Queries took 2.451ms · About: xarray-datasette