Opened 8 years ago
Closed 8 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 , 8 years ago
| Component: | Uncategorized → Database layer (models, ORM) |
|---|
comment:2 by , 8 years ago
comment:3 by , 8 years ago
| Resolution: | → needsinfo |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Can you elaborate on the details of the memory leak?
Database-level cascade is the subject of #21961.