Search code examples
memory-managementv8

V8 engine memory management : difference between code segment and code space in heap


When you search for V8 engine memory management, you will find this blog very cool with this great image:

v8-engine-memory-management-map-1

where you can find a "code space" in the memory heap described as a store for JIT compiled code blocks or a space with executable memory.

But I also find this scheme: v8-engine-memory-management-map-2 and other similar alternatives where a "code segment" section appears.

Is this the same or different and can someone explain the difference?

I tried to search for explanations but nothing to do


Solution

  • The term "code segment" is sometimes used for non-JIT-compiled code. Since you didn't provide a source/context for the second image, I can't tell whether that's what was meant there. It's also possible that whoever used the image considered the terms "code space" and "code segment" interchangeable and hence used them to refer to the same thing.

    In short: when you find a confusing blog post, please ask the post's author for clarifications.

    (FWIW, the blog post you did link contains a bunch of claims I would disagree with, so my recommendation would be not to give it too much trust or attention.)