Can V8 crash due to memory allocation failure? Can this crash the entire process?

33 views
Skip to first unread message

Paul Baker

unread,
Aug 3, 2016, 5:55:21 AM8/3/16
to v8-u...@googlegroups.com
It appears that V8 allocates JavaScript objects on a manually-managed
heap, memory for which is ultimately obtained from mmap/VirtualAlloc
(on Linux/Windows). However, for its internal data structures, V8
seems to use C++ standard containers such as `std::vector` [1]. If
these containers need to allocate memory, but are unable to, they
usually throw `std::bad_alloc`.

However, V8 is compiled with -fno-exceptions [2]. If exceptions cannot
be used, how does V8 handle the situation where the internal data
structures are unable to allocate memory? Does it crash? If so, does
this take down any process which embeds V8?

[1]: https://github.com/v8/v8/search?utf8=%E2%9C%93&q=std%20vector
[2]: https://groups.google.com/d/msg/v8-users/ffdydgcdavM/rKiTQlzvAgAJ

Jochen Eisinger

unread,
Aug 5, 2016, 6:04:30 AM8/5/16
to v8-u...@googlegroups.com

V8 doesn't (consistently) handle oom situations but expects the allocator to crash the process if it can't fulfill a request.


--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages