Disable pointer compression? Disable the sandbox?

274 views
Skip to first unread message

Ben Ernst

unread,
Aug 28, 2023, 11:31:02 PM8/28/23
to v8-dev
Hey team.

I've been following the conversations around pointer compression and the memory usage caps that this feature imposes on v8. I compile my own V8 to use in an embedded context. What is the current state of affairs of memory limits in V8, and to what extent can I disable, increase, or workaround them? What GN compile-time flags should I be setting? I'm currently on V8 11.6. I target only Windows 10+ and Ubuntu 18.04+. I used to set run-time flag "--max-old-space-size" but that doesn't seem to do what it used to do.

My existing compile flags are as follows:

treat_warnings_as_errors=false
v8_enable_i18n_support=false
v8_monolithic=true
is_component_build=false
use_custom_libcxx=false
is_clang=false
v8_use_external_startup_data=false

Thanks in advance!
Ben

Jakob Kummerow

unread,
Aug 30, 2023, 9:00:21 AM8/30/23
to v8-...@googlegroups.com
With the default configuration, --max-old-space-size should work for values up to 4GiB.

If you need more, you need to disable pointer compression (which implies disabling the sandbox, because the sandbox relies on compressed pointers for its isolation mechanics). That's easy to do with:
v8_enable_pointer_compression = false
v8_enable_sandbox = false
Note that this will increase memory consumption by probably around 60-70% (pointers become twice as big, non-pointer data such as numbers and string characters remains the same, so the overall balance depends on your workload). 
This will allow you to configure arbitrary maximum heap sizes.

Note that you need to #define (or not define) V8_COMPRESS_POINTERS for the parts of your embedding code that #include V8 headers such that it matches your V8 build configuration.

Ben Ernst

unread,
Aug 30, 2023, 10:54:22 PM8/30/23
to v8-...@googlegroups.com
Thank you very much Jakob, that's precisely the guidance that I was looking for.
Warm regards,
Ben

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to a topic in the Google Groups "v8-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-dev/-k10-Qmy1f8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CAKSzg3Tw6LkGJkft72TRvCk9Se9Yk%2BxgW6scLdL5KSw1YM6NBg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages