1

I peeped into materialize dropdown code

and in the service folder (ng2-dropdown-state.ts) I can see the use

of EventEmitter but in the component folder I can't see any unsubscribe on

the ngOnDestroy hook.

So I'm wondering if could be memory leak problem.

May be I'm wrong but I'd like to know is or not

in any part of the code there was a way to avoid the

memory leak problem.

Can someone explain me, please ?

FAISAL
  • 33,618
  • 10
  • 97
  • 105
Whisher
  • 31,320
  • 32
  • 120
  • 201

1 Answers1

2

Assuming you are referring to unofficial ng2-material-dropdown - afaik yes, there is possibility of memory leak, because the RxJS Subject (that EventEmitter extends) is subscribed to here and never unsubscribed. Also as an EventEmitter it cannot be finished - that's why it shouldn't be subscribed manually to, they are intended to be used in Angular's @Output() only.

Good you've seen that, so you can choose better library or make a pull request to this one.

Daniel Kucal
  • 8,684
  • 6
  • 39
  • 64