Open
Description
- Version: llnode 1.7.0, node v8.11.1
- Platform: OS X (10.13.4)
- Subsystem: findjsobjects, findjsinstances, inspect
Right now if we declare a class (let's say, Lira
), and we don't create an instance of that class, v8 findjsobjects
will still show us that we have 1 instance of Lira
. If we have a class with instances (let's say, Lero
), v8 findjsobjects
will show us one more instance than we actually have. Example of this behavior below.
I'm not sure how mdb_v8 handles this, but Chrome DevTools snapshots won't count classes as objects. Should we change the current behavior? Or maybe make it clearer when some object is actually a class instead of an instance?
Example:
index.js
class Lero {
constructor() {
this.lala = {};
}
}
class Lira {
constructor() {
this.lele = {};
}
}
const lero = new Lero();
function foo() {
const lero2 = new Lero();
boom();
}
foo();
llnode results
Instances Total Size Name
---------- ---------- ----
1 24 AssertionError
1 24 AsyncResource
1 24 FastBuffer
1 24 Lira
1 24 Loader
1 24 ModuleJob
1 24 ModuleMap
1 24 Performance
1 24 PerformanceObserver
1 24 SafeMap
1 24 SafePromise
1 24 SafeSet
1 24 TextDecoder
1 24 TextEncoder
1 24 TickObject
1 24 URL
1 24 URLContext
1 24 URLSearchParams
1 24 WebAssembly
1 24 console
1 32 (Object)
1 104 ImmediateList
1 104 Stack
1 112 Console
2 48 (anonymous)
2 48 process
2 64 ChannelWrap
2 64 Signal
2 120 Resolver
2 128 PerformanceNodeTiming
2 136 NextTickQueue
2 200 PerformanceObserverEntryList
2 208 WriteStream
2 272 Module
2 608 ReadableState
2 640 WritableState
3 72 NodeError
3 96 TTY
3 216 Lero
3 248 BufferList
3 280 AsyncHook
12 384 ContextifyScript
14 1120 (ArrayBufferView)
55 3520 NativeModule
327 10464 (Array)
642 36248 Object
6896 53488 (String)
---------- ----------
8009 109504