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

0.7.5 Memory leak #370

Closed
andreymal opened this Issue Jul 31, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@andreymal
Copy link

andreymal commented Jul 31, 2018

0.7.5 broke my website again :)

import gc
from pony.orm import * 

db = Database()

class Testing(db.Entity):
    description = Optional(LongStr)
    name = Required(str, 256)

db.bind('sqlite', ':memory:')
db.generate_mapping(create_tables=True)

# prepare data

print('fill database...')
with db_session:
    for i in range(20):
        Testing(description=str(i) * 4, name=str(i))

# test it!

@db_session
def testme():
    testing_list = list(Testing.select())


print('started')
i = 0
while True:
    i += 1
    if i % 100 == 0:
        gc.collect()  # actually it does nothing
    testme()

~5MB/s leaks on my laptop (faster without gc)

@andreymal

This comment has been minimized.

Copy link
Author

andreymal commented Jul 31, 2018

Fun fact: the leak is gone when I ran my website with FLASK_ENV=development or FLASK_DEBUG=1. Dunno why

@sashaaero

This comment has been minimized.

Copy link
Member

sashaaero commented Jul 31, 2018

Hello! We are feeling sorry that you met such problems. We'll try to fix it as soon as possible.

@sashaaero sashaaero added the bug label Jul 31, 2018

@sashaaero sashaaero added this to the 0.7.6 milestone Jul 31, 2018

@kozlovsky kozlovsky closed this in 8d9cbec Jul 31, 2018

@kozlovsky

This comment has been minimized.

Copy link
Member

kozlovsky commented Jul 31, 2018

The memory leak should be fixed now. Can you check please?

@andreymal

This comment has been minimized.

Copy link
Author

andreymal commented Jul 31, 2018

👍

kozlovsky added a commit that referenced this issue Aug 8, 2018

Pony ORM Release 0.7.6rc1 (2018-08-08)
# New features

* f-strings support in queries: select(f'{s.name} - {s.age}' for s in Student)
* #344: It is now possible to specify offset without limit: `query.limit(offset=10)`
* #371: Support of explicit casting of JSON expressions to `str`, `int` or `float`
* `@db.on_connect` decorator added

# Bugfixes

* Fix bulk delete bug introduced in 0.7.4
* #370 Fix memory leak introduced in 0.7.4
* Now exists() in query does not throw away condition in generator expression: `exists(s.gpa > 3 for s in Student)`
* #373: 0.7.4/0.7.5 breaks queries using the `in` operator to test membership of another query result
* #374: `auto=True` can be used with all PrimaryKey types, not only int
* #369: Make QueryResult looks like a list object again: add concatenation with lists, `.shuffle()` and `.to_list()` methods
* #355: Fix binary primary keys `PrimaryKey(buffer)` in Python2
* Interactive mode support for PyCharm console
* Fix wrong table aliases in complex queries
* Fix query optimization code for complex queries

kozlovsky added a commit that referenced this issue Aug 10, 2018

Pony ORM Release 0.7.6 (2018-08-10)
# Features since 0.7.5:

* f-strings support in queries: `select(f'{s.name} - {s.age}' for s in Student)`
* #344: It is now possible to specify offset without limit: `query.limit(offset=10)`
* #371: Support of explicit casting of JSON expressions to `str`, `int` or `float`
* `@db.on_connect` decorator added

# Bugfixes

* Fix bulk delete bug introduced in 0.7.4
* #370 Fix memory leak introduced in 0.7.4
* Now `exists()` in query does not throw away condition in generator expression: `exists(s.gpa > 3 for s in Student)`
* #373: 0.7.4/0.7.5 breaks queries using the `in` operator to test membership of another query result
* #374: `auto=True` can be used with all PrimaryKey types, not only `int`
* #369: Make QueryResult looks like a list object again: add concatenation with lists, `.shuffle()` and `.to_list()` methods
* #355: Fix binary primary keys `PrimaryKey(buffer)` in Python2
* Interactive mode support for PyCharm console
* Fix wrong table aliases in complex queries
* Fix query optimization code for complex queries
* Fix a bug with hybrid properties that use external functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.