3

I'm a bit confused about node.js domains. I'm using them to catch errors that may be thrown in asynchronous code.

I'm not sure though, whether or not domains automatically clean themselves up for garbage collection once the domain.run(blah) has finished, or wether or not I have to manually call domain.dispose() once I am done with the domain?

The problem with domain.dispose() is that it also destroys all io streams that the domain may have been intercepting, which is not what I want as I'm just using this particular domain to just catch thrown errors in asynchronous code.

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
balupton
  • 47,113
  • 32
  • 131
  • 182
  • https://groups.google.com/forum/#!topic/nodejs/UCqbgxI8gRw seems to have some info but not enough to give a clear answer – balupton Aug 17 '13 at 16:31

1 Answers1

3

don't use it, it will be deprecated: https://github.com/joyent/node/issues/5018

Jonathan Ong
  • 19,927
  • 17
  • 79
  • 118
  • 1
    Just in case someone else misreads this, as I did at first glance, it's the "dispose" method of domains that is being deprecated, not domains themselves. – user4815162342 Oct 28 '13 at 00:05