Static `super` may cause a unwanted "memory leak".

Bergi a.d.bergi at web.de
Tue Aug 2 20:09:32 UTC 2016


/#!/JoePea schrieb:

> ```js
> export default
> function SomeFactory(name) {
>   let tmp = {
>     [name]() { /* this doesn't use `super` */ }
>   }
>   return tmp[name]
> }
> ```
>
> Then that will store each new `tmp` object in memory although the user of
> the factory only cares about the functions created.

Why would `tmp` be stored as the [[HomeObject]] when the function 
doesn't use `super`? In that case a [[HomeObject]] is not needed at all.

kind regards,
  Bergi


More information about the es-discuss mailing list