diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-06-07 14:09:27 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-06-07 14:37:43 +0200 |
| commit | cfcca7ccce3dc527d16757ff6dc978e50c4a2e61 (patch) | |
| tree | 81b5ac70392c045d4ed7f9fa3adf7cd5d875cb96 /docs/faq | |
| parent | e2112edd9ac6a5f1877a62dd1c88d2d1726350de (diff) | |
| download | django-cfcca7ccce3dc527d16757ff6dc978e50c4a2e61.tar.gz | |
Fixed #3711, #6734, #12581 -- Bounded connection.queries.
Prevented unlimited memory consumption when running background tasks
with DEBUG=True.
Thanks Rob, Alex, Baptiste, and others.
Diffstat (limited to 'docs/faq')
| -rw-r--r-- | docs/faq/models.txt | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/docs/faq/models.txt b/docs/faq/models.txt index 94011d254f..57e3c8077f 100644 --- a/docs/faq/models.txt +++ b/docs/faq/models.txt @@ -32,6 +32,12 @@ same interface on each member of the ``connections`` dictionary:: >>> from django.db import connections >>> connections['my_db_alias'].queries +If you need to clear the query list manually at any point in your functions, +just call ``reset_queries()``, like this:: + + from django.db import reset_queries + reset_queries() + Can I use Django with a pre-existing database? ---------------------------------------------- @@ -76,22 +82,3 @@ type, create an initial data file and put something like this in it:: As explained in the :ref:`SQL initial data file <initial-sql>` documentation, this SQL file can contain arbitrary SQL, so you can make any sorts of changes you need to make. - -Why is Django leaking memory? ------------------------------ - -Django isn't known to leak memory. If you find your Django processes are -allocating more and more memory, with no sign of releasing it, check to make -sure your :setting:`DEBUG` setting is set to ``False``. If :setting:`DEBUG` -is ``True``, then Django saves a copy of every SQL statement it has executed. - -(The queries are saved in ``django.db.connection.queries``. See -:ref:`faq-see-raw-sql-queries`.) - -To fix the problem, set :setting:`DEBUG` to ``False``. - -If you need to clear the query list manually at any point in your functions, -just call ``reset_queries()``, like this:: - - from django import db - db.reset_queries() |
