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

Memory Leak Health Check

Memory Leak Health Check

Andrew Duncan

May 10, 2015
Tweet

More Decks by Andrew Duncan

Other Decks in Technology

Transcript

  1. 1. Memory Management 2. Tools of the trade MEMORY LEAK

    HEALTH CHECK Our Quest to Diagnose & Cure © 2015 SwarmOnline
  2. WHY IS THIS TOPIC IMPORTANT? • Move to richer /

    interactive applications • More use of JavaScript to achieve this • Single Page Applications • Cross integration of multiple frameworks and technologies • Multiple device types, operating systems and browsers © 2015 SwarmOnline
  3. MEMORY LEAK DEFINITION mem . o . ry leak noun

    COMPUTING noun: memory leak; plural noun: memory leaks a failure in a program to release discarded memory, causing impaired performance or failure. © 2015 SwarmOnline
  4. YES • Garbage Collection NO • Coding Mishaps DOESN’T THIS

    GET HANDLED FOR ME? © 2015 SwarmOnline
  5. •1st round of testing •Instantaneous view of memory •Useful for

    monitoring changes over small periods of time TASK MANAGER © 2015 SwarmOnline
  6. • Monitors memory over time • Sudden drops === GC

    • Look out for two things: • Steady rise in the chart • GC not returning to original memory usage TIMELINE © 2015 SwarmOnline
  7. N.B. • Memory is skewed just by having Chrome Developer

    Tools open • Observer Effect © 2015 SwarmOnline
  8. OTHER BROWSER TOOLS All of these browsers have tools that

    can be used to monitor memory • Internet Explorer • Safari • Firefox © 2015 SwarmOnline
  9. TASK MANAGER & WINDOWS TOOLS • Record memory usage in

    Perfmon & PsTools (PsList) • Plot and view memory usage over time • In our case 1 hour, 24 hours, 1 week, 1 month PsTools PsList © 2015 SwarmOnline
  10. TASK MANAGER & WINDOWS TOOLS Pipe data out to CSV

    for charting © 2015 SwarmOnline
  11. AUTOMATE MEMORY MONITORING How do we do this? • Virtual

    Machines • Auto snapshot every X minutes • Reduce Observer Effect • Graph your results © 2015 SwarmOnline
  12. HOW TO DO THIS YOURSELF • Strip it back to

    basics • App in container only • Send data but don’t enable parsing • Add in the data package • If your app has multiple parsers for different types of data, enable each data packet individually • Gradually add in your controllers and view • Each view will need tested individually • Create your app with only one view enabled • We run over 30 VM’s with different versions of an app to get as much coverage as possible © 2015 SwarmOnline
  13. HOW TO DO THIS YOURSELF (2) • If you suspect

    something is going wrong • Take snapshot • Run code • Take snapshot • Review differences • Obviously new data (e.g. Ajax requests) are going to skew your results between snapshots © 2015 SwarmOnline
  14. FINAL THOUGHTS • If all else fails… • Or in

    extreme circumstances…rm -rf* © 2015 SwarmOnline