Skip to main content
April 5, 2017
Risolto

Multiple forms causing possible EventEmitter memory leak console warning

  • April 5, 2017
  • 3 risposte
  • 2465 visualizzazioni

I am working on a project that entails putting two different marketo forms on the same page.  This is resulting in the following console error:

     (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

The console trace points to marketo's form2 js file.  I have even tried removing every event listener on my end just to be sure.

Anyone have any ideas?

Thanks.

Questo argomento è stato chiuso alle risposte.
Migliore risposta di SanfordWhiteman

You have to link to your code.

The error is pretty accurate: a userland event management library (EventEmitter, developed I think originally by Joyent) is used by Forms2. Unlike native browser events, EE tries to be aware of when a stack limit is reached, sometimes creating unnecessary worry.

3 risposte

SanfordWhiteman
Level 10
April 5, 2017

You have to link to your code.

The error is pretty accurate: a userland event management library (EventEmitter, developed I think originally by Joyent) is used by Forms2. Unlike native browser events, EE tries to be aware of when a stack limit is reached, sometimes creating unnecessary worry.

April 7, 2017

Turned out there were too many calls to MktoForms2.whenReady().

SanfordWhiteman
Level 10
April 7, 2017

Right, you can almost always combine those event listeners (just seek the form ID in the listener).