Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixups #1148

Merged
merged 2 commits into from
Mar 16, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
src: use Number::New() for heapTotal/heapUsed
With --max_old_space_size=12345 it's possible to create a JS heap that
is larger than what fits in an unsigned int so use Number::New() rather
than Integer::NewFromUnsigned().

Performance-wise, it doesn't matter much.  If V8 can fit the double in
a SMI, it will.

PR-URL: #1148
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
  • Loading branch information
bnoordhuis committed Mar 16, 2015
commit 2551c1d2caaec21a5098de8e86274e0daf7aa781
8 changes: 4 additions & 4 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1932,10 +1932,10 @@ void MemoryUsage(const FunctionCallbackInfo<Value>& args) {
HeapStatistics v8_heap_stats;
env->isolate()->GetHeapStatistics(&v8_heap_stats);

Local<Integer> heap_total =
Integer::NewFromUnsigned(env->isolate(), v8_heap_stats.total_heap_size());
Local<Integer> heap_used =
Integer::NewFromUnsigned(env->isolate(), v8_heap_stats.used_heap_size());
Local<Number> heap_total =
Number::New(env->isolate(), v8_heap_stats.total_heap_size());
Local<Number> heap_used =
Number::New(env->isolate(), v8_heap_stats.used_heap_size());

Local<Object> info = Object::New(env->isolate());
info->Set(env->rss_string(), Number::New(env->isolate(), rss));
Expand Down