Re: cx_Oracle - Django ORM - Reference Count Increase

Shai Berger <shai-9mtU2oJkgntWk0Htik3J/[email protected]> Mon, 29 Dec 2014 23:18:12 +0200
Newsgroups gmane.comp.python.db.cx-oracle
Organization Platonix Joint Ventures
Message-ID <[email protected]>
Hi,

On Monday 29 December 2014 19:57:55 Amaury Forgeot d'Arc wrote:
> 2014-12-27 22:23 GMT+01:00 Anurag Chourasia <[email protected]>:
> > I have a Long Running Python Process that uses Django ORM against Oracle
> > database.
> > 
> > The size of the process keeps on increasing steadily.
> > 
> > I was profiling this process using mem_top and i find that the reference
> > count of one particular data type <list> increases continuously with
> > iterations.
> > 
> > Datatype is <type 'list'> [{u'time': u'0.004', u'sql': u'QUERY =
> > u\'SELECT "RANGE_STATUS"."I
> > 
> > References increased from 534 to 53295
> 
> This list looks very much like this one:
> https://docs.djangoproject.com/en/1.7/faq/models/#how-can-i-see-the-raw-sql
> -queries-django-is-running
> 
> I don't know why there should be many references to it, but it's definitely
> a Django thing.

I am a Django core team member, and yes, this is definitely a Django thing.

You can prevent this list from being created by changing your DEBUG setting to 
False; or, if you do need debug info, close the connection once in every 
while; this will free the list of queries. A new connection will be opened 
automatically when you execute the next database query (you cannot use the 
CONN_MAX_AGE setting for this, because it is tied to the requests cycle, and 
you apparently do not have requests).

As none of the above is Oracle-specific, the proper forum for further 
discussion of this is the django-users list[1] or the #django IRC channel on 
freenode.net.

[1] http://groups.google.com/group/django-users

HTH,
	Shai.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net