Memory leak in django while maintaining link of all instances of forms

This is a continuation of this stream .

I have implemented a method of storing a link to all my forms in an array, as mentioned by the selected answer, but unfortunately I get a memory leak on every request to the django node.

This code is as follows:

This is my regular form, which I am expanding, which has the function of saving links to neighboring forms, and whenever I create a new form, it is simply added to the _instances stack.

class StepForm(ModelForm):
    TAGS = []
    _instances = []

    def __new__(cls, *args, **kwargs):
        instance = object.__new__(cls)
        cls._instances.append(instance)
        return instance

Although this is more of a problem with python, then Django I decided it was better to show you the full context that I am encountering in this problem.

As requested, I am posting what I'm trying to accomplish with this feat:

js- , , , JS, . . , , , .

0
2

, Python, ( Django). , , - . , , ( ) , ( ) .

: - - . , , , , (, , ) .

EDIT: , , "". Django, - , , , ( ). "" ( Python) .

  • ( , ..).

FWIW , , Django. ( - ), , . ajax , . , , , , , - , .

2 ...

+2

- - . .

, - , , _instances. . , 100 100 , , 1 000 1 000 .. - , .

, ? ?

+1

All Articles