#21953: Memory leak in 1.6.1 in DB manager
----------------------------------------------+----------------------------
     Reporter:  steve.hutchinz@…              |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.6
     Severity:  Normal                        |   Keywords:  memory leak DB
 Triage Stage:  Unreviewed                    |  manager
Easy pickings:  0                             |  Has patch:  0
                                              |      UI/UX:  0
----------------------------------------------+----------------------------
 Since upgrading from 1.4 to 1.6.1 my app is consuming memory rather
 rapidly.
 I have this issue on both my live Ubuntu 64bit server (python 2.7.5+,
 django 1.6.1) and on my development Windows 7 32bit (python 2.7.3, django
 1.6.1)

 After some diagnosis I have created a minimal test app that replicates
 this issue which I can replicate using both SQLite and Postgresql (9.3,
 psycopyg2 2.5.2) either using the model manager or raw sql connection.

 Here's my test model and test python app. The settings are plain standard
 with the addition of the 'app1' application:
 (I know that the two different test functions do not return the same
 objects - this is just test code)

 ---------------MODEL-----------------
 from django.db import models

 class Customer(models.Model):
     name = models.CharField(max_length=256,unique=True)

     class Meta:
         ordering = ["id"]
         app_label = 'app1'

 --------------TEST-----------------
 import os
 import sys

 SETTINGS  = "testsqlite.settings"
 THE_PATH = r'D:\dev\django\testsqlite'

 os.environ["DJANGO_SETTINGS_MODULE"] = SETTINGS
 sys.path.append(THE_PATH)

 from django.db import connection
 from django.core.exceptions import ObjectDoesNotExist

 from models import Customer

 def GetCustomerSQL(name):
     cursor = connection.cursor()
     sql = "SELECT id FROM app1_customer WHERE name = '%s'" % name
     cursor.execute(sql)
     customer = cursor.fetchone()
     del cursor
     return customer

 def GetCustomer(name):
     customer = None
     try:
         customer = Customer.objects.get(name=name)
     except ObjectDoesNotExist:
         pass
     return customer

 while 1:
     #customer = GetCustomerSQL('Steve')
     customer = GetCustomer('Steve')
     del customer

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21953>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.77ab8f15268bf3a9ccd377ecd4727a7a%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to