Skip to content

Commit

Permalink
fix: restore initial heap limit automatically
Browse files Browse the repository at this point in the history
PR-URL: #220
  • Loading branch information
legendecas authored Jan 12, 2023
1 parent 623b0d2 commit 2fbfea0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/hooks/heap_limit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ size_t NearHeapLimitCallback(void* data, size_t current_heap_limit,
size_t increased_heap =
current_heap_limit + auto_incr_heap_limit_size * 1024 * 1024;

ThreadId thread_id = *static_cast<ThreadId*>(data);
InfoT(module_type, thread_id,
EnvironmentData* env_data = static_cast<EnvironmentData*>(data);
InfoT(module_type, env_data->thread_id(),
"current_heap_limit is %d, initial_heap_limit is %d, "
"auto_incr_heap_limit_size is %d, increased_heap is "
"%d.",
Expand All @@ -32,10 +32,10 @@ size_t NearHeapLimitCallback(void* data, size_t current_heap_limit,

void AutoIncreaseHeapLimit(v8::Isolate* isolate) {
EnvironmentData* env_data = EnvironmentData::GetCurrent(isolate);
ThreadId thread_id = env_data->thread_id();

InfoT(module_type, thread_id, "auto increase heap limit hook.");
InfoT(module_type, env_data->thread_id(), "auto increase heap limit hook.");
isolate->AddNearHeapLimitCallback(NearHeapLimitCallback,
static_cast<void*>(&thread_id));
static_cast<void*>(env_data));
isolate->AutomaticallyRestoreInitialHeapLimit();
}
} // namespace xprofiler
} // namespace xprofiler

0 comments on commit 2fbfea0

Please sign in to comment.