I have embedded V8 in my C++ application using the instructions found on 
Google webpage. The application waits for requests from different clients 
to preform different tasks. Each requests is handled as a separate thread 
in the application and each thread calls the following function:
 
LRESULT 
CJS_Data::ExecuteJScript(char* jString)
{
 USES_CONVERSION;
 v8::Isolate* isolate = v8::Isolate::New();
 {
  v8::Isolate::Scope iscope(isolate);
  v8::V8::Initialize();
  v8::Locker l(isolate);
  v8::HandleScope handle_scope;
  v8::Persistent<v8::Context> context = v8::Context::New();
  v8::Context::Scope context_scope(context);
  v8::TryCatch trycatch;
  
  v8::Handle<v8::String> soruce = v8::String::New(jString);
  bool bOK = true;
  if(soruce.IsEmpty()){ bOK = false; }
  v8::Handle<v8::Script> script = v8::Script::Compile(soruce);
  if(script.IsEmpty()){ bOK = false; }
  v8::Handle<v8::Value> result = script->Run();
  if(result.IsEmpty()){ bOK = false;}
  if(bOK)
  {
   v8::String::AsciiValue ascii(result);
   char txt[30];
   sprintf(txt, "%s", ascii);
   SetStatusItem(txt, "", 0);
   UpdateClient();
  } else
  {
   v8::Handle<v8::Value> exception = trycatch.Exception();
   v8::String::AsciiValue exception_str(exception);
   char errmsg[150];
   sprintf(errmsg, "%s", exception_str);
   SetStatusItem("", errmsg, -123);
   UpdateClients();
  }
 }
 isolate->Dispose();
 return true;
}
 
This works fine during times when there are few clients connected ie when 
there are fewer than 40-45 threads executing at the same time. But if I 
increase the load above 45 threads exectuing at the same time, I get a 
message stating that the VMachine is dead. I have scanned the internet for 
any hint or solution and it seems like some posts indicate that I have 
runned out of viritual memory. see 
https://groups.google.com/forum/?fromgroups#!topic/nodejs/YIOgRt5NGtI%5B1-25%5D 
I 
do not know how to encrease the viritual memory on my windows machine or if 
this acually is the problem.
 
Is there anyone out there how has any idea or clue on how to correct this 
problem?

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to