Opened 18 years ago
Closed 16 years ago
#4111 closed (invalid)
Warning References stored in memory when DEBUG=True
Reported by: | 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 , 18 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 17 years ago
comment:3 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
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.
Django stores a log of all the SQL in memory when
DEBUG
isTrue
, and this is documented (along with a warning about memory use). Am I missing something obvious here that makes this a bug?