Alir3z4/django-cuser

Memory leak?

Closed this issue · 2 comments

I believe this is a rather dumb question, but... the developer needs to remember to call del_user in order to avoid the memory from filling up with user objects here , right?

It's really common for developers to forget to clean-up, so why not add a signal handler that hooks into https://docs.djangoproject.com/en/dev/ref/signals/#django.core.signals.request_finished and calls del_user at the end of each HTTP request?

On both process_response and process_exception the user object will be deleted, which means after processing/ending the request.

Perfect, I missed that!