Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Memory Chronicles: Manage, Trace and Fix Memory Leaks

Memory Chronicles: Manage, Trace and Fix Memory Leaks

Talk at Node+JS Interactive 2019

Giovanny Gongora

December 12, 2019
Tweet

More Decks by Giovanny Gongora

Other Decks in Technology

Transcript

  1. Memory Chronicles: Manage,
    Trace and Fix Memory Leaks
    Giovanny Gongora

    @Gioyik

    View Slide

  2. Giovanny
    [email protected]
    @gioyik

    View Slide

  3. © 2019 NodeSourc
    e
    What is this really?

    View Slide

  4. © 2019 NodeSourc
    e
    See you at 2pm!

    View Slide

  5. Who had a memory issue with
    a Node.js application before?

    View Slide

  6. It happens in real life, happens
    in TNT

    View Slide

  7. Heap profiler & Timeline

    View Slide

  8. When to use them?

    View Slide

  9. Workflow for diagnosing
    memory leaks?

    View Slide

  10. TST

    View Slide

  11. Three Snapshot Technique

    View Slide

  12. What do the Shallow and
    Retained Size columns represent?

    View Slide

  13. Where should I start digging
    into to discover if I have a leak?

    View Slide

  14. Redacted snapshots

    View Slide

  15. Core Dumps

    View Slide

  16. Create a Core dump

    View Slide

  17. --abort-on-uncaught-exception

    View Slide

  18. LLDB

    View Slide

  19. Llnode

    View Slide

  20. Caveats

    View Slide

  21. llnode’s coupling to V8

    View Slide

  22. Promises (?)

    View Slide

  23. Async / Await FTW!

    View Slide

  24. Tips for different situations

    View Slide

  25. Case #1:
    Server Side Rendering (SSR)

    View Slide

  26. Case #2:
    Monitoring tools

    View Slide

  27. Case #3
    Close your connections

    View Slide

  28. Case #4:
    Look for agnostic serve pages solution

    View Slide

  29. Case #5:
    Review you packages

    View Slide

  30. Case #6:
    Keep naming you functions

    View Slide

  31. Case #6:
    Check how reliable are your 3rd services

    View Slide

  32. Crazy … right?

    View Slide

  33. Thank you!

    View Slide