[Python] How to debug memory leak on DigitalOcean App Platform

Discussão em 'Python' iniciado por Stack, Janeiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    My Django application run perfectly fine on my local machine, memory usage fluctuate between 700MB and 800MB, but when I execute the exact same code on DigitalOcean App Platform the memory usage is constantly increasing until it reach 100%. Then the application reboot.

    What could cause the issue and how to find the root cause ?

    I have tried to force the execution of the garbage collector with gc.collect() and also to isolate the problem with the @profile decorator from the memory_profiler package, but the memory incrementation isn't associated with any line of my code.

    Environnement version

    • Local : Python 3.10.12 + Ubuntu 22.04.3
    • DigialOcean : Docker + Python 3.10.13

    I track memory usage like this :

    total = memory_usage()[0]
    logger.info(f"Memory used : {total} MiB")

    Continue reading...

Compartilhe esta Página