mirror of https://github.com/lukechilds/node.git
Browse Source
Remove the 'gc' event from the v8 module and remove the supporting infrastructure from src/. It gets the axe because: 1. There are currently no users. It was originally conceived as an upstreamed subset of StrongLoop's strong-agent GC metrics, but the strong-agent code base has evolved considerably since that time and has no use anymore for what is in core. 2. The implementation is not quite sound. It calls into JS land from inside the GC epilog and that is unsafe. We could fix that by delaying the callback until a safe time but because there are no users anyway, removing it is all around easier. PR-URL: https://github.com/iojs/io.js/pull/174 Reviewed-By: Trevor Norris <trev.norris@gmail.com>archived-io.js-v0.12
Ben Noordhuis
10 years ago
5 changed files with 3 additions and 303 deletions
@ -1,46 +0,0 @@ |
|||
// Copyright (c) 2014, StrongLoop Inc.
|
|||
//
|
|||
// Permission to use, copy, modify, and/or distribute this software for any
|
|||
// purpose with or without fee is hereby granted, provided that the above
|
|||
// copyright notice and this permission notice appear in all copies.
|
|||
//
|
|||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
|||
// Flags: --expose_gc
|
|||
|
|||
var common = require('../common'); |
|||
var assert = require('assert'); |
|||
var v8 = require('v8'); |
|||
|
|||
assert(typeof gc === 'function', 'Run this test with --expose_gc.'); |
|||
|
|||
var ncalls = 0; |
|||
var before; |
|||
var after; |
|||
|
|||
function ongc(before_, after_) { |
|||
// Try very hard to not create garbage because that could kick off another
|
|||
// garbage collection cycle.
|
|||
before = before_; |
|||
after = after_; |
|||
ncalls += 1; |
|||
} |
|||
|
|||
gc(); |
|||
v8.on('gc', ongc); |
|||
gc(); |
|||
v8.removeListener('gc', ongc); |
|||
gc(); |
|||
|
|||
assert.equal(ncalls, 1); |
|||
assert.equal(typeof before, 'object'); |
|||
assert.equal(typeof after, 'object'); |
|||
assert.equal(typeof before.timestamp, 'number'); |
|||
assert.equal(typeof after.timestamp, 'number'); |
|||
assert.equal(before.timestamp <= after.timestamp, true); |
Loading…
Reference in new issue