High memory usage
See original GitHub issueThe memory usage of xESMF seems quite high, higher than standalone ESMF CLI, and I wonder if this is due to a possible leak, as loading from a saved weights file uses much less RAM? Additionally, perhaps it can be improved by using lower precision (32bit vs 64bit). I also note it doesn’t seem possible to destroy a Regridder object to free memory?
import xesmf
import numpy as np
import gc
@profile
def test():
src_ds = {'lat': np.arange(29.5,70.5,0.05), 'lon': np.arange(-23.5,45.0,0.05)}
dst_ds = xesmf.util.grid_2d(29, 70, 0.03, -23, 45, 0.03)
regridder = xesmf.Regridder(src_ds, dst_ds, 'bilinear')
regridder = None
gc.collect()
print("collected")
test()
python3 -m memory_profiler memtest.py
Line # Mem usage Increment Line Contents
================================================
4 65.500 MiB 65.500 MiB @profile
5 def test():
6 65.500 MiB 0.000 MiB src_ds = {'lat': np.arange(29.5,70.5,0.05), 'lon': np.arange(-23.5,45.0,0.05)}
7 160.461 MiB 94.961 MiB dst_ds = xesmf.util.grid_2d(29, 70, 0.03, -23, 45, 0.03)
8 1246.199 MiB 1085.738 MiB regridder = xesmf.Regridder(src_ds, dst_ds, 'bilinear')
9 1246.203 MiB 0.004 MiB regridder = None
10 1246.203 MiB 0.000 MiB gc.collect()
11 1246.203 MiB 0.000 MiB print("collected")
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Windows 10 High Memory Usage [Causes and Solutions]
How to Fix Windows 10 High Memory Usage · Close unnecessary programs. · Disable startup programs. · Disable Superfetch service. · Increase virtual ......
Read more >High memory usage. How to fix them - Microsoft Community
1) See fixes for high RAM usage: · 2) Optimize Virtual Memory: · 3) Type Resource in Search box, open Resource Monitor as...
Read more >How to Fix High Memory Usage in Windows - Make Tech Easier
How to Fix High Memory Usage in Windows · 1. Close Unnecessary Programs and Applications · 2. Remove Unwanted Programs from Your PC...
Read more >Why is my RAM usage so high when nothing is running?
Possible reasons for high RAM usage · PC has too many programs that start during the startup · Potential Virus attack · Registry...
Read more >How to Fix High Memory Usage with Windows 10 - Shred Cube
6 Tips for Fixing High Memory Usage · 1. Close Programs You're Not Using · 2. Move Select Files to an External Hard...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi.
Is there any news regarding this issue? We are experiencing similar problems.
Our application needs to perform regriding many times, and we have tracked that each usage of the Regridder causes a massive increase in memory usage, which is not released.
Has this issue come to any resolution?
Thanks
I just became aware of this issue, and thought I would chime in from the ESMPy perspective (ESMPy is the engine behind xESMF). The ESMF 8.1.0 release, expected at the end of March '21, will include a fix for a memory leak in the search algorithm of the regridding code. This may resolve the memory issues discussed in this thread. There should be a new conda package version of ESMPy 8.1.0 by the first of April.