Skip to content

async-wrap: add provider id and object info cb

Re-add the wrapper class id to AsyncWrap instances so they can be tracked directly in a heapdump.

Previously the class id was given without setting the heap dump wrapper class info provider. Causing a segfault when a heapdump was taken. This has been added, and the label_ set to the given provider name so each instance can be identified.

R=@bnoordhuis

For performance testing I ran the following:

var JSStream = process.binding('js_stream').JSStream;
var ITER = 1e7;
var t = process.hrtime();

for (var i = 0; i < ITER; i++)
  new JSStream();

t = process.hrtime(t);
console.log(((t[0] * 1e9 + t[1]) / ITER).toFixed(1) + ' ns/op');

It was the most direct way I found to instantiate a new AsyncWrap instance from JS. It shows no performance degradation with this patch applied.

Merge request reports

Loading