Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak problem #1

Closed
pokerc opened this issue Dec 30, 2019 · 1 comment
Closed

memory leak problem #1

pokerc opened this issue Dec 30, 2019 · 1 comment

Comments

@pokerc
Copy link

pokerc commented Dec 30, 2019

When i try to read the two orc file, and i found the memory of the first reader have not been released. I found no del() in the Reader. How can i release the memory.
`
import os
import sys
import pyorc
from memory_profiler import profile
import gc

@Profile
def main():
fr = open("000748_0", "rb")
r = pyorc.reader
reader = r.Reader(fr)
for i in range(100):
pass
a = reader.read(1000)
b = reader.read(20000)
c = reader.read(10000)
del reader
del r
del a,b,c
fr.close()
gc.collect()
fr = open("001751_0","rb")
r = pyorc.reader
reader = r.Reader(fr)
cnt = reader.len()
for i in range(cnt):
a = reader.next()
c = [1] * (10 ** 6)

if name == 'main':
main()`

@noirello
Copy link
Owner

Hello, thank you for reporting it.

I've looked into it, and found an unnecessary pybind11:object release call that created dangling/never decremented bytes objects during reading the ORC file. Creating a Reader object includes reading the metadata from the file, thus the faulty function was invoked during the Reader's initialisation.

I pushed the fix commit to upstream.

@noirello noirello closed this as completed Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants