minerllabs / minerl

MineRL Competition for Sample Efficient Reinforcement Learning - Python Package
http://minerl.io/docs/
Other
711 stars 153 forks source link

A possible memory leak in BufferedBatchIter #561

Closed alper111 closed 3 years ago

alper111 commented 3 years ago

I am not sure whether the problem is due to the BufferedBatchIter, or it's an expected behavior. Though, it feels like it shouldn't happen.

Steps to reproduce

import minerl
from minerl.data import BufferedBatchIter

data = minerl.data.make('MineRLObtainDiamondDenseVectorObf-v0')
iterator = BufferedBatchIter(data, buffer_target_size=50000)

count = 0
for (s, a, r, sn, d) in iterator.buffered_batch_iter(batch_size=32, num_epochs=1):
        # ... do something with the data.
        count += len(r)
        print(count)

print("epoch finished %d" % count)

In my machine with 16gig memory, python process is killed when count ~= 500K. I watch the memory from htop and it is indefinitely increasing, even though I do not make any deepcopy.

Expected behavior

The loop should finish successfully, without any memory issue since I am not recording anything.

Observed behavior

The process is killed when count is around 500K.

Miffyli commented 3 years ago

This is (somewhat) expected behaviour: the data iterator uses a lot of memory. Test things with MineRLTreechop-v0 data and see if it still increases without limits.

For this reason we used load_data in our baselines for this year's competition to make it fit into Colab's memory limits :')

alper111 commented 3 years ago

Alright, got it. Thanks for the quick response.