question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory leak in loop with higher.innerloop_ctx!

See original GitHub issue

I saw this problem was solved however, I still have it:

I am using the last version of higher 0.1.5, however still have a problem with memory leak:

with higher.innerloop_ctx(model, inner_opt, copy_initial_weights=False) as (fast_model, diffopt):
          for step, batch in enumerate(epoch_iterator):
                    report_memory()
                    print("-------------")
                    fast_model.train()
                    outputs = fast_model(batch)
                    loss = outputs[0]  
                    diffopt.step(loss)

memory (MB) | allocated: 678.73095703125 | max allocated: 678.73095703125 | cached: 734.0 | max cached: 734.0 memory (MB) | allocated: 1357.4619140625 | max allocated: 2036.19287109375 | cached: 2158.0 | max cached: 2158.0 memory (MB) | allocated: 12340.314453125 | max allocated: 13059.771484375 | cached: 13208.0 | max cached: 13208.0 memory (MB) | allocated: 23322.634765625 | max allocated: 24041.8564453125 | cached: 24190.0 | max cached: 24190.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nooralahzadehcommented, Feb 28, 2020

@renesax14 There is no any version that mitigate this issue as I understood. It is on progress to solve !

0reactions
tathagatvcommented, Nov 18, 2022

@egrefen I’m facing this issue with the higher library when I am using the higher.path.make_functional function to make a forward pass through an LSTM model. How should I explicitly delete the backwards graph when I’m done with the inner and outer loop steps? As of now, the GPU consumption keeps increasing as more batches are processed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Memory leak - promises in a loop - Stack Overflow
Not sure whether it would be the cause of memory leaks, but your function definitely has a ton of unnecessary cruft that could...
Read more >
Possible memory leak with for loop - MATLAB Answers
Possible memory leak with for loop. Learn more about memory, for loop, memory leak MATLAB, Statistics and Machine Learning Toolbox.
Read more >
Memory leak in loops - Esri Community
Memory leak in loops ... layer and writes the result to the memory workspace and then calculates ... Here is part of the...
Read more >
Hunting Java Memory Leaks - Toptal
For one, they put unnecessary pressure on your machine as your programs consume more and more resources. To make things worse, detecting these...
Read more >
3 Troubleshoot Memory Leaks - Java - Oracle Help Center
To know more about the JFR commercial license, see the license agreement. The following sections show figures and describe how to debug a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found