Hello!

I'm @captainsafia!

safia.rocks

content warning

this is a technical talk with no code or demos.

@captainsafia

j.mp/js-mem-live

Follow along!  🎉

@captainsafia

turing machine

Von Neumann architecture

A machine that thinks is remarkable.

A MACHINE THAT REMEMBERS WHAT IT THINKS IS REVOLUTIONARY.

@captainsafia

""But my laptop has 16 gbs of memory.

Why should i care about memory performance?""

@captainsafia

User expectations and demands grow faster than memory availability.

@captainsafia

@captainsafia

Not all your users are using the latest tech.

@captainsafia

You don't want to be that app.

YOU KNOW THAT APP.

Let's go to class.

garbage collection

V8

@captainsafia

The Memory Heap

V8 allocates objects in memory into contiguous chunks, or spaces.

  • New space

  • Old pointer space

  • Old data space

  • Large object space

  • Code space

@captainsafia

So, we've allocated objects in memory.

@captainsafia

The Memory Heap

But, how does V8 collect garbage memory?

@captainsafia

Run a short garbage collection cycle.

Halt the program.

@captainsafia

Scavenging

@captainsafia

Mark and Sweep

@captainsafia

How much memory is my application using?

 

How often do GC cycles occur in my application?

@captainsafia

The right tools for a messy job.

@captainsafia

@captainsafia

Let's try it.

@captainsafia

  • memewatch

  • heapdump

  • v8-profiler

  • performance monitoring tools

@captainsafia

WHen should i use all these things?

@captainsafia

""I had your To-do list app open in my browser and it makes it crash after a while!""

@captainsafia

""your app has jank and jitters""

@captainsafia

""your app just sucks""

@captainsafia

memory management is hard.

@captainsafia

v8 makes it easy and obfuscates the details from us.

@captainsafia

But eat your vegatables and appreciate your garbage collector. ❤️

@captainsafia

live long and prosper! 🖖🏾

safia@safia.rocks — SAFIA.ROCKS — @captainsafia

memory-in-javascript

By Safia Abdalla

memory-in-javascript

The deck for my talk on memory management in JavaScript.

  • 2,648

More from Safia Abdalla