(embedded) Is it possible to set a soft memory limit per Isolate?

27 views
Skip to first unread message

Mark Tarrabain

unread,
Apr 2, 2017, 1:36:07 AM4/2/17
to v8-users
Is it possible to get the v8 engine when using it from a C++ application to utilize a soft-memory limit per isolate such that if the bounds are exceeded, the isolate will simply be irrecoverably terminated instead of crashing the process?  While aborting a process might be acceptable when the javascript code is isolated (hah! a pun!)  enough from your native application that it is easy to invoke as a separate process, and you can just wait for it to finish, it is much less practical when you are wanting to utilize javascript to customize the behavior of C++ functions, where the native code wants to repeatedly call javascript functions for certain tasks, and in turn the javascript may invoke functions that are implemented as native functions which are part of your main program, and where these functions need to be generally able to read and write shared data that is ordinarily visible to all threads (a multiprocess model is not amenable to this without complicating the program with expensive interprocess communication that is necessary to simply share the data, where the data would otherwise be equally visible to all relevant tasks because they would simply be different threads running on the same process).

I really like v8's highly C++ centered design, which does not seem to be shared by most of the alternatives that I have seen for embedding Javascript in a native application, but the necessity of not having an application crash just because it might have run some badly behaved javascript code is absolutely critical for my purposes.

Zac Hansen

unread,
Apr 3, 2017, 3:50:49 AM4/3/17
to v8-users
This has been asked for numerous times and the responses that I've seen are: "run it in a separate process" and "we take patches as long as it doesn't slow down anything".
Reply all
Reply to author
Forward
0 new messages