Django: Class based view instantiated for each request, is it efficient?
Question: I found this in the Django documentation:

> While your class is instantiated for each request dispatched to it, class
> attributes set through the as_view() entry point are configured only once at
> the time your URLs are imported.

Wouldn't instantiating view for each request be inefficient? I understand
python is good in garbage collection but couldn't it be cause of concern
during high traffic as it may lead to server run out of memory before the
objects could be garbage collected.


Answer: Beside the comment from jpmc26 I would guess its not a big problem. If you
follow the workflow Django is doing from when a request is coming in until the
response is rendered, there are way more steps involved which initiate
objects. The class-based view is probably the least of the problem, assuming
you didn't implement it to be blocking.

