Opened 18 years ago

Closed 16 years ago

#4111 closed (invalid)

Warning References stored in memory when DEBUG=True

Reported by: David Cramer <dcramer@…> Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django is storing references to the "Warning" exception (from the SQL engine) in memory when DEBUG mode is turned on. I believe this is not intended as it raises memory usage considerably and I can't see it's use anywhere.

Change History (3)

comment:1 by Simon G. <dev@…>, 18 years ago

Triage Stage: UnreviewedAccepted

comment:2 by James Bennett, 17 years ago

Django stores a log of all the SQL in memory when DEBUG is True, and this is documented (along with a warning about memory use). Am I missing something obvious here that makes this a bug?

comment:3 by Kenneth Arnold, 16 years ago

Resolution: invalid
Status: newclosed

The only reference to Warning that I can find in django.db is in backends/mysql/base.py:

if settings.DEBUG:
    from warnings import filterwarnings
    filterwarnings("error", category=Database.Warning)

Since the Database module is loaded (in the django.db.backends.mysql.base module, plus the Python module cache), the Warning object, whether expensive or not, is getting stored anyway as one of its globals. Closing as invalid for now; feel free to reopen if I missed the point.

What you're probably seeing is the potentially huge memory use of django.db.connecction.queries when DEBUG is on, which is a separate issue.

Note: See TracTickets for help on using tickets.
Back to Top