clarification on leaks during v8 context creation

9 views
Skip to first unread message

madana gopal

unread,
Nov 29, 2017, 12:59:32 PM11/29/17
to nodejs
Hi Team,

We are trying to embed v8 within c++ application. Through the application, v8 context is loaded for every new javascript. And, context is destroyed , on the javascript exit by the user. In this way new context is created and destroyed for every javascript usage. In this way, it looks heap memory created by a context is getting retained and not garbage collected, even after the context is destroyed. Please find the below code, to get clear idea, on what is observed.

//code executed during javascript start
Local<Context>  localContext = node::makeContext(isolate, sandbox);
persistentContext.Reset(isolate, localContext);
printf("Size of newly created context is [%ld] \n",persistentContext.EstimatedSize());
fflush(stdout);

//code executed during javascript exit
persistentContext.Reset();

Here, EstimatedSize() is increasing 1.5 MB for every context creation (i.e estimated size coming for second context created is 1.5 MB more than the value came for first context). Please clarify the way to debug the case. How EstimatedSize() increased value can be identified?. Please provide suggestion.

Thanks.

Regards,
Madan 
Reply all
Reply to author
Forward
0 new messages