"version = undefined" seems not touch GC, but when I use "version.prototype = undefined", then the GC will collection immediately. I want to know why?
On Thursday, June 27, 2013 10:41:08 PM UTC+8, Ben Noordhuis wrote: > > On Thu, Jun 27, 2013 at 3:52 PM, Lew Janyu > <[email protected]<javascript:>> > wrote: > > Please view the code below: > > > > // d8 --expose-gc > > > > for(var i = 0; i < 1000000; i++) > > { > > // allocation huge memory > > var buffer = []; > > buffer.length = 100000; > > // assign to some native function's prototype > > version.prototype[i] = buffer; > > } > > // clean the function to dereference the buffers > > version = undefined; > > // force gc > > gc(); > > > > print("gc was done, but the memory footprint is still huge. why?"); > > // pause > > for(;;); > > Calling gc() doesn't guarantee that V8 will collect all garbage. It > generally performs just enough collection to get by (something of a > simplification but approximately correct.) > > By the way, you mention 'memory footprint' but not if that means RSS or > VSZ. > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
