Opened 6 years ago

Closed 6 years ago

#29321 closed Bug (needsinfo)

when instance.delete() while cause memory leak

Reported by: yywing Owned by: nobody
Component: Database layer (models, ORM) Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

class A(models.Model):
    xxxxxxx
class B(models.Model):
    a = models.ForeignKey(A, on_delete=models.CASCADE)
    xxxxx
class C(models.Model):
    b = models.ForeignKey(B, on_delete=models.CASCADE)
    xxxxxx
A.objects.first().delete()

When I delete an instance of A, if A has is related with many B and B is related with many C, then it will cause memory leak.
And I found django on_delete has no effect at SQL level.
And I really want that when I delete A ,related B is deleted.

Change History (3)

comment:1 by yywing, 6 years ago

Component: UncategorizedDatabase layer (models, ORM)

comment:2 by Tim Graham, 6 years ago

Can you elaborate on the details of the memory leak?

Database-level cascade is the subject of #21961.

comment:3 by Tim Graham, 6 years ago

Resolution: needsinfo
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top