Instances referenced by 'bound_this' only are not garbage collected

后端 未结 3 1343
孤独总比滥情好
孤独总比滥情好 2021-02-05 02:14

I have a question regarding garbage-collection in google chrome (Version 20.0.1132.47, Ubuntu 11.04 64bit).

While comparing heap-dumps and checking for memory-leaks, I d

3条回答
  •  迷失自我
    2021-02-05 02:26

    I have referred this in EcmaScript, this term "bound this" with class,

    Class methods have “bound this”, where this in the method body is always bound to the class instance from which the method was extracted, regardless of what this parameter is actually passed in to the method (the this parameter to the method is ignored).

    Now here in your example there is no sample script given so can not be specific to question,

    I have to say if this is not leak..

    then with what ever object, class the script is bounded, it will not call garbage until the class/object exist as this function is bounded with the same object.. it will garbage collected only after its parent's(the object/class with which it is bounded) scope ends.

    Now if circular reference when the task will finish it will come to end,>> this works like concept of Recursion(mind it concept, not same as).. so the end will start from the last call.. in reverse.. the inner most call(latest call) will be released first.. and so on

    The code must be buggy as they must not bind and define function and reuse each time.. but if they are binding then also it should work fine and should not leak until the footprint goes out of the browser limit of memory pool.

    I hope this will explain..

提交回复
热议问题