The characteristics of the memory usage rising and then not declining is most likely not a memory leak, but due to Python's memory management, which doesn't necessarily release memory back to the operating system (I don't know enough about the details of that but worth having a search around on google for more context) If the memory was always rising with each page access, then I'd reconsider that, but that doesn't sound like what you you're saying?
It's worth looking into why so much memory is being used of course. I don't know what the serializers and model definitions look like, but if you're using nested representations, or if there's lots of relational data in there, then the small number of rows might still correspond to a very high number of lookups, and a large amount of data being returned. There's plenty of scope in REST framework for dropping down to less abstracted layers. If there's good reason to expect a particular view to be resource intensive then you should consider moving to a plain view with `.values_list()` and `.select_related()/.prefetch_related()` used appropriately. I'd suggest making sure that you can clearly replicate the behavior, so you're confident *exactly* what case reproduces it. Double check exactly what query is being generated, and if necessary stop using generic view behaviour and serializers and start using explicit view logic instead with a `.value_list()` queryset. -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
