Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
quick-testing node/v8 memory/object limits
/*
node --max_old_space_size=3000 --prof nodemem.js
# --trace_incremental_marking=true --incremental_marking_steps=false
node --max_old_space_size=3000 --max_new_space_size=3000 --max_executable_size=1000 --gc_global --prof nodemem.js
# --noincremental_marking
# --nolazy_sweeping
# --never_compact
# --gc_global
# --gc_interval=100000000
*/
var utilz = require('utilz')
var objs = 100000000;
var arr = [], a = []
arr.push(a)
var start = Date.now()
for(var i = 0; i < objs; i++) {
a.push({ r: true })
if(i % 1000000 === 0) {
console.log(i)
a = []
arr.push(a)
}
}
var end = Date.now()
var dur = utilz.timeSpan(end - start)
var mem = process.memoryUsage()
mem.rss = utilz.formatNumber(mem.rss)
mem.heapTotal = utilz.formatNumber(mem.heapTotal)
mem.heapUsed = utilz.formatNumber(mem.heapUsed)
console.log(utilz.formatNumber(objs) + ' objects allocated; rss(' + mem.rss + ') heapTotal(' +
mem.heapTotal + ') heapUsed(' + mem.heapUsed + ') in ' + dur)
Owner

youurayy commented Feb 20, 2012

node --max_new_space_size=3000 --max_executable_size=1000 --max_old_space_size=3000 \
--prof nodemem.js

   ticks  total  nonlib   name
  37282   39.9%   39.9%  v8::internal::IncrementalMarking::RecordWriteSlow
  11239   12.0%   12.0%  v8::internal::IncrementalMarking::ActivateIncrementalWriteBarrier
   9813   10.5%   10.5%  v8::internal::IncrementalMarking::PrepareForScavenge
   7509    8.0%    8.0%  v8::internal::MarkObjectGreyDoNotEnqueue
   4891    5.2%    5.2%  v8::internal::IncrementalMarking::RecordWriteForEvacuationFromCode
   3434    3.7%    3.7%  v8::internal::JSReceiver::DeleteElement
   3050    3.3%    3.3%  v8::internal::IncrementalMarking::UpdateMarkingDequeAfterScavenge
   1913    2.0%    2.0%  v8::internal::JSProxy::GetElementWithHandler
   1469    1.6%    1.6%  v8::internal::JSProxy::HasElementWithHandler
   1209    1.3%    1.3%  v8::internal::LoadIC::Load

Owner

youurayy commented Feb 20, 2012

node --max_new_space_size=3000 --max_executable_size=1000 --max_old_space_size=3000 \
--prof --noincremental_marking nodemem.js

   ticks  total  nonlib   name
  24874   32.5%   32.5%  v8::internal::MarkingVisitor::VisitPointers
  12093   15.8%   15.8%  v8::internal::MarkingVisitor::~MarkingVisitor
  11064   14.4%   14.4%  v8::internal::FixedBodyVisitor<v8::internal::StaticMarkingVisitor, v8::internal::FixedBodyDescriptor<12, 20, 20>, void>::Visit
   6719    8.8%    8.8%  v8::internal::StaticMarkingVisitor::VisitJSWeakMap
   5828    7.6%    7.6%  v8::internal::MarkCompactCollector::Prepare
   3550    4.6%    4.6%  v8::internal::FlexibleBodyVisitor<v8::internal::StaticMarkingVisitor, v8::internal::FixedArray::BodyDescriptor, void>::Visit
   2098    2.7%    2.7%  v8::internal::FixedBodyVisitor<v8::internal::StaticMarkingVisitor, v8::internal::FixedBodyDescriptor<4, 12, 16>, void>::Visit
   1492    1.9%    1.9%  v8::internal::ScavengingVisitor<(v8::internal::MarksHandling)0, (v8::internal::LoggingAndProfiling)0>::EvacuateObject<(v8::internal::ScavengingVisitor<(v8::internal::MarksHandling)0, (v8::internal::LoggingAndProfiling)0>::ObjectContents)0, (v8::internal::ScavengingVisitor<(v8::internal::MarksHandling)0, (v8::internal::LoggingAndProfiling)0>::SizeRestriction)0>
    787    1.0%    1.0%  v8::internal::StaticMarkingVisitor::DataObjectVisitor::Visit
    586    0.8%    0.8%  v8::internal::MarkCompactCollector::MarkDescriptorArray
    541    0.7%    0.7%  v8::internal::Heap::CreateInitialMaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment