Embedding RustyV8: Fatal JavaScript out of memory: Reached heap limit
I created this Criterion benchmark to estimate the cost of serialization, but it runs out of memory.
Am I supposed to destroy
json_v8_str
and _json_obj
explicitly?
3 Replies
You should create and drop
HandleScope
for each iterator, otherwise V8 can't do garbage collection and runs our of memoryIndeed that solved the issue.
@bartlomieju
I was thinking about implementing a custom deserializer (e.g. from bincode), and did a trivial benchmark of String::new, but it seems rather slow? I assume the V8 deserializer has a more direct/lowlevel approach? Would it be feasible to do in Rust using the RustyV8 bindings?
Not really, strings are slow because they require a memcopy