just a thought: do you have DEBUG turned off in your settings?
if not, django will store all qeuries it made in memory so that it is
accessible for debugging purposes...

On 1/13/07, Rob J Goedman <[EMAIL PROTECTED]> wrote:

Hi,

We converted an access system written in VB to a Django app. The pure
db side and GUI work great. Data is also obtained from control panels
that have fingerprint readers attached. So I wrote a separate python
program to 'scan' these control panels (embedded linux based) and
store it in Django models/postgres tables.

I noticed that I have a memory leak. Tried anything I can think of. I
stripped out all useful parts (it uses twisted and some other stuff,
but those are not the problem). The problem is that below small
(useless) program grows eternally (well in this example until
i=1000). I do need to refresh the cpl model in the loop every few
seconds, i.e. using admin or views control panels can be enabled or
disabled or change IP address, etc.

import gc, mcp.settings
from mcp.Control_Panels.models import ControlPanel

for i in range(1, 1000):
        cpl = list(ControlPanel.objects.all())
        for j in range(1, 1000000):
                j += 1
        if i % 10 == 0:
                print '.'
#               gc.collect()

Normally the delays are natural and are controlled via Twisted (TCP
and callLater). Above program is stable if I comment out the cpl=list
(...) statement, otherwise it grows forever.

I run on several Macs (ppc and intel), latest Mac OS, latest svn
version of Django, Postgres 8.2.0 and psycopg2-2.0.5.1. We have also
seen this behavior on FC5.

Has anyone used Django/psycopg in a similar setting? I could try just
psycopg, not to hard in this example, but less elegant with the real
set of o2o, m2m and fk models.

Thanks,
Rob


>



--
Honza Kr l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to