mirror of https://gitee.com/bigwinds/arangodb
gc adjustment
This commit is contained in:
parent
2bf7c0dcd4
commit
0d8bf44215
|
@ -151,7 +151,7 @@ void ConsoleThread::inner () {
|
|||
|
||||
while (! _userAborted) {
|
||||
if (nrCommands >= gcInterval) {
|
||||
TRI_RunGarbageCollectionV8(isolate, 1.0);
|
||||
TRI_RunGarbageCollectionV8(isolate, 0.5);
|
||||
nrCommands = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1440,7 +1440,7 @@ void ApplicationV8::shutdownV8Instance (const string& name, size_t i) {
|
|||
localContext->Enter();
|
||||
v8::Context::Scope contextScope(localContext);
|
||||
|
||||
TRI_RunGarbageCollectionV8(isolate, 5.0);
|
||||
TRI_RunGarbageCollectionV8(isolate, 30.0);
|
||||
|
||||
TRI_GET_GLOBALS();
|
||||
if (v8g != nullptr) {
|
||||
|
|
|
@ -3954,9 +3954,8 @@ void TRI_CreateErrorObject (v8::Isolate *isolate,
|
|||
|
||||
TRI_V8_RETURN(TRI_V8_STRING_UTF16( (const uint16_t*) result.getBuffer(), result.length()));
|
||||
}
|
||||
else {
|
||||
TRI_V8_RETURN(v8::String::NewFromUtf8(isolate, ""));
|
||||
}
|
||||
|
||||
TRI_V8_RETURN(v8::String::NewFromUtf8(isolate, ""));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -3982,6 +3981,16 @@ v8::Handle<v8::Array> static TRI_V8PathList (v8::Isolate* isolate, string const&
|
|||
return scope.Escape<v8::Array>(result);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief execute a single garbage collection run
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_SingleRunGarbageCollectionV8 (v8::Isolate* isolate,
|
||||
int idleTimeInMs) {
|
||||
isolate->LowMemoryNotification();
|
||||
return isolate->IdleNotification(idleTimeInMs);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief run the V8 garbage collection for at most a specifiable amount of
|
||||
/// time
|
||||
|
@ -3994,6 +4003,9 @@ void TRI_RunGarbageCollectionV8 (v8::Isolate* isolate,
|
|||
if (availableTime >= 5.0) {
|
||||
idleTimeInMs = 10000;
|
||||
}
|
||||
if (availableTime >= 10.0) {
|
||||
idleTimeInMs = 100000;
|
||||
}
|
||||
|
||||
double const until = TRI_microtime() + availableTime;
|
||||
|
||||
|
@ -4007,10 +4019,8 @@ void TRI_RunGarbageCollectionV8 (v8::Isolate* isolate,
|
|||
|
||||
int gcTries = 0;
|
||||
|
||||
isolate->LowMemoryNotification();
|
||||
while (++gcTries <= gcAttempts) {
|
||||
if (isolate->IdleNotification(idleTimeInMs)) {
|
||||
// we're done
|
||||
if (TRI_SingleRunGarbageCollectionV8(isolate, idleTimeInMs)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4019,14 +4029,10 @@ void TRI_RunGarbageCollectionV8 (v8::Isolate* isolate,
|
|||
while (TRI_microtime() < until) {
|
||||
if (++i % 1000 == 0) {
|
||||
// garbage collection only every x iterations, otherwise we'll use too much CPU
|
||||
isolate->LowMemoryNotification();
|
||||
// todo 1000 was the old V8-default, is this really good?
|
||||
while (++gcTries <= gcAttempts) {
|
||||
if (isolate->IdleNotification(idleTimeInMs)) {
|
||||
// we're done
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (++gcTries > gcAttempts ||
|
||||
TRI_SingleRunGarbageCollectionV8(isolate, idleTimeInMs)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
usleep(100);
|
||||
|
|
|
@ -215,6 +215,12 @@ void TRI_CreateErrorObject (v8::Isolate* isolate,
|
|||
void TRI_normalize_V8_Obj (const v8::FunctionCallbackInfo<v8::Value>& args,
|
||||
v8::Handle<v8::Value> obj);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes a single garbage collection run
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_SingleRunGarbageCollectionV8 (v8::Isolate*, double);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief run the V8 garbage collection for at most a specifiable amount of
|
||||
/// time
|
||||
|
|
Loading…
Reference in New Issue