[Bug] Possibile memory leak in save
See original GitHub issueI have found a possibile memory leak in the ffmpeg adapter in spleeter_utils/audio/ffmpeg.py
, when calling to save
:
process = subprocess.Popen(
command,
stdout=open(os.devnull, 'wb'),
stdin=subprocess.PIPE,
stderr=subprocess.PIPE)
# Write data to STDIN.
try:
process.stdin.write(data.astype('<f4').tostring())
except IOError:
raise IOError(f'FFMPEG error: {process.stderr.read()}')
# Clean process.
process.stdin.close()
if process.stderr is not None:
process.stderr.close()
process.wait()
get_logger().info('File %s written', path)
################################################################
current_mem, peak_mem = tracemalloc.get_traced_memory()
overhead = tracemalloc.get_tracemalloc_memory()
summary = "traced memory: %d KiB peak: %d KiB overhead: %d KiB" % (
int(current_mem // 1024), int(peak_mem // 1024), int(overhead // 1024)
)
print( "after save", summary )
################################################################
After consecutive calls the memory will not be de-allocated, and it consists of the whole block of the input file (~30MB each time):
before save traced memory: 31558 KiB peak: 32248 KiB overhead: 30933 KiB
after save traced memory: 31560 KiB peak: 32946 KiB overhead: 30935 KiB
before save traced memory: 63630 KiB peak: 64324 KiB overhead: 58610 KiB
after save traced memory: 63632 KiB peak: 65018 KiB overhead: 58611 KiB
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:15
Top Results From Across the Web
Find and fix Memory Leaks in Windows 10 - YouTube
A Memory Leak is a misplacement of resources in a computer program due to faulty memory allocation. It happens when a RAM location...
Read more >Any news on the memory leak save bloat/crash bug? - Reddit
Try loading your saves, one at a time, from in-game. If one loads, that particular save isn't corrupted but something nearby might be...
Read more >How To Detect and Prevent Memory Leaks | Scout APM Blog
Leaks waste space by filling up pages of memory with inaccessible data and waste time due to extra paging activity. Leaked memory eventually ......
Read more >Possible memory leak? - Bugs reports - GDevelop Forum
I used two nested repeat loops to create a million variables. When loading the debugger, GDevelop crashed saying there was some limit of...
Read more >How to fix memory leaks Monterey - Setapp
So it's quite critical you solve the issue as fast as possible. ... How do you tell a memory leak bug from a...
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 Free
Top 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
I’m still facing this memory leak issue. Also, the workaround results in an error
Do not use tf.reset_default_graph() to clear nested graphs. If you need a cleared graph, exit the nesting and create a new graph.
tensorflow==2.3 spleeter==2.2.2@mmoussallam can you help me out with this?
This bug should be fixed now that we’ve moved on to TF 2