Jeff-Lewis / cls-hooked

cls-hooked : CLS using AsynWrap or async_hooks instead of async-listener for node 4.7+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Memory leak]The destroyNamespace method doesn't seem to work

GO-DIE opened this issue · comments

I used the following code to test and found a memory leak.

const cls = require('cls-hooked') while(1){ const ns = cls.createNamespace('test') ns.run(() => {}); cls.destroyNamespace('test'); }

The destroyNamespace method doesn't seem to work.

This is most likely the case where gc doesn't get to come and remove everything that is scheduled via async-hook.

Try adding some timeout at the back of your code and look at the memory used.