I'm learning about memory management of chrome v8 engine,
const v8 = require('v8');
console.log(v8.getHeapSpaceStatistics())
what does read_only_space
、map_space
mean?
Those are different parts of V8's managed heap. As their names imply, read_only_space
is for read-only data (and should have constant size throughout the lifecycle of your app), and map_space
is for what V8 internally calls "maps" (a.k.a. "shape descriptors" or "hidden classes"; note this has nothing to do with a JavaScript new Map()
). Most of your app's memory usage will be in old_space
, and possibly large_object_space
if you allocate very large objects.