I'm not really very familiar with retain cycles in Node.js coming more from Objective-C/iOS, but I wrote a bit of code that I'm hoping will not lead to a retain cycle. I'm not sure how intelligently V8 deals with garbage collection or how intelligent I'm supposed to be at this!
In my example, I create an object that is supposed to handle making a data connection and feeding that data back to the parent object. In order to do this, I use the EventEmitter .on functions to register parent object functions. The parent object gets released when all of the data is processed, but after that will this create a retain cycle between the parent and the child objects? Sample code
// Create the SonarData with the necessary information
this.sonardata = new SonarData( this.key, this.size )
// Hook events
.on( 'error', this.handleError.bind( this ) )
.on( 'done', this.handleDone.bind( this ) )
.on( 'data', this.handleData.bind( this ) );