I figured out the issue @ptrblck !
I was using this package GitHub - msamogh/nonechucks: Deal with bad samples in your dataset dynamically, use Transforms as Filters, and more! 11
With this issue:
  

      github.com/msamogh/nonechucks
  

  
    
  
	  
  

  
    
      Memory leak 13
    

    
      
        opened 
        
          
        
        Jun 7, 2019
      
      


      
        
          
          shrubb
        
      
    

    
    
  


  
    Hi,

when the below example is run, the RAM usage grows forever:

```python3…
import torch, torch.utils.data
import nonechucks

class DummyDataset(torch.utils.data.Dataset):
    def __len__(self):
        return 1_000_000

    def __getitem__(self, idx):
        return 666

dataset = nonechucks.SafeDataset(DummyDataset())

for _ in torch.utils.data.DataLoader(dataset):
    pass
```

Notes:

* Here the increase is quite slow; for a RAPID bug demonstration, replace `666` with `torch.empty(10_000)` (be careful to kill the process in time, before you're OOM!).
* No problems without `SafeDataset`.
* Without `torch.utils.data.DataLoader`, the leak is still there, although at a smaller scale, around 1 MB of RAM is lost per 30000-40000 `__getitem__` calls.
* PyTorch 1.0.1, nonechucks 0.3.1.
  

  

  
    
    
  

  


Subtle bug to track down