Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Memory leak? #276
(I tried to reproduce this for few months and today I did it >_<)
import gc from datetime import datetime from pony.orm import * db = Database() class Author(db.Entity): comments = Set('Comment') class Post(db.Entity): pass class Comment(db.Entity): author = Required(Author) db.bind('sqlite', ':memory:') db.generate_mapping(create_tables=True) # prepare data print('fill database...') with db_session: a = Author(id=1) for i in range(2, 5000): Author(id=i) Post(id=i) Comment(author=a) del a # test it! @db_session def testme(): author = Author.get(id=15) comments_list = Comment.select(lambda x: x.author.id == author.id) ids = list(select(x.id for x in Post)) print('started') while True: testme() gc.collect()
If you run it, then memory of python process will leak (+8MB per second on my machine).
Very strange things that prevented me from reproducing it: