Menu

1 / 4

Why Your JavaScript App Gets Slower the Longer It Stays Open

JavaScript in Plain English - Medium·Bestte·4 days ago
#ec4RlunI
Reading 0:00
15s threshold

Member-only story

Why Your JavaScript App Gets Slower the Longer It Stays Open

Bestte

5 min read8 hours ago

Garbage collection handles memory automatically. So why do some web applications keep using more of it?

Press enter or click to view image in full size

A web application can feel perfectly fine when you first open it.

The dashboard loads quickly. Switching between views feels smooth. Nothing seems particularly expensive.

Then you leave it open for a few hours.

The tab starts consuming more memory. Some interactions feel slower. Eventually, refreshing the page becomes the easiest way to make everything feel normal again.

It doesn’t happen to every application, and high memory usage doesn’t automatically mean there’s a leak.

But there’s a particular kind of JavaScript problem that can explain this behavior.

Objects that should have disappeared are still being kept alive.

And JavaScript’s garbage collector can’t always save us from that.

JavaScript cleans up memory.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.