liveBook · Manning

Large Object Space

As explained in JavaScript in Depth

A V8 heap area for objects large enough to require separate large-object memory management.

A string can obey ECMAScript’s abstract model yet occupy a very different location in V8’s heap. Large Object Space is the separate heap region for allocations too large to fit within ordinary pages or young-generation semi-spaces. section 2.2.2 section 9.2.1

V8 divides the heap into pages, typically around 256 KB, that normally hold multiple heap objects. Each large object instead receives its own dedicated page sized to contain it. For strings, values below 128 KB remain on regular pages; larger strings move to Large Object Space. section 2.2.2

The placement decision changes the object’s collection lifecycle:

  • Normal young-generation allocations can survive scavenges and later be promoted to the old generation. section 9.2.1
  • Allocations too large for young-generation semi-spaces skip that path and enter Large Object Space directly. section 9.2.1
  • Large allocations therefore carry old-generation collection costs from creation rather than receiving cheap young-generation collection first. section 9.2.1

A large string

Creating a string larger than V8’s 128 KB string threshold places it in Large Object Space instead of a regular heap page. The ECMAScript specification permits a far larger abstract maximum, but V8 enforces implementation and memory limits. section 2.2.2

Figure 9.3 V8 divides its heap into distinct spaces. The young generation contains two semi-spaces (from-space and to-space), only one active at a time. Objects that survive two scavenges are promoted to the old generation. Allocations too large for the young generation go directly to the large object space.

Trace how ordinary objects move through young and old generations while oversized allocations bypass that progression. section 9.2.1

How JavaScript in Depth covers it

How deep it goes
Defines pages, thresholds, dedicated allocation, and lifecycle consequences while deferring deeper memory-management details.
Examples
Uses 128 KB string placement and a heap-layout figure showing large allocations bypassing young-generation semi-spaces.
What it assumes
Builds from heap, page, and heap-object definitions rather than assuming prior V8 memory-management knowledge.
What you can do after
Evaluate why oversized V8 allocations bypass cheap young-generation collection and incur old-generation costs immediately.
How it connects
Connects heap pages, heap objects, strings, young generation, old generation, and garbage collection.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of JavaScript in Depth. The section links point to the parts of the book it draws on.