steineggerlab / foldcomp

Compressing protein structures effectively with torsion angles
GNU General Public License v3.0
145 stars 14 forks source link

[Bug] Memory leakage issue in foldcomp.get_data #29

Closed Oxer11 closed 1 year ago

Oxer11 commented 1 year ago

Hi, thanks for the quick fix for #25. Since the original issue has been closed, I open a new issue for this problem. I still face the memory leakage problem after changing the code to:

import os
import sys
import psutil
import foldcomp

with open("afdb_rep_v4.lookup", "r") as f:
  lines = f.readlines()
  ids = [line.strip().split("\t")[1] for line in lines]

batch_size = 1000
for i in range(0, len(ids), batch_size):
  with foldcomp.open("afdb_rep_v4", ids=ids[i:i+batch_size]) as db:
    for (name, pdb) in db:
      data_dict = foldcomp.get_data(pdb)
    print(psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024, "MB")

I get the following output:

1204.1328125 MB
1613.5859375 MB
2070.83984375 MB
2570.0234375 MB
3086.8125 MB
3591.9765625 MB
4031.50390625 MB
4481.984375 MB
4976.78125 MB

So I assume there are still some problems in foldcomp.get_data. Could you help take a look?

khb7840 commented 1 year ago

I've updated to fix this. Please check if this happens in the latest release (v0.0.4.post1).

Oxer11 commented 1 year ago

Thanks for the quick update! Everything works for me now!!!