Im getting a Fatal Jerryscript Error: ERR_REF_COUNT_LIMIT error when I try to start a timeout. Any suggestions for how to overcome this?
const signalTimeout;
if ((flag === true) && (!signalTimeout) ) { signalTimeout = setTimeout(noSignal(), 1800000); console.log('set signal timeout') }
There is a clearTimeout later when a signal is received, however the fatal error occurs right after entering the conditional statement.
Thanks,
Best AnswerA reference count limit can be caused by trying to keep too many references to an object. I'm wondering now if there's something in your function that's creating heaps of references; eg, getElementById.
Recursion could be another culprit.
I still feel that those () are a worry.
You're calling noSignal (look at those parenthesis()) instead of juat passing it to setTimeout.
If you have that piece of code inside some kind of loop, it could reach some limits bevause it gets executed without limits.
Add a console log to see how many times it gets called just in case.
Best Answer> Hmm thanks. I removed the parenthesis but I am still getting this error.
Then this code must be called too often resulting in creation of more than 1024 timers. I don't see any other possibilities. In this case, you must see more than thousand log messages.
But the typical reason for this error is not associated with this code but rather with usage of getElementById on every UI update without caching. To check that, try to comment out that code and see if you still get an error.
Best AnswerI suspect the problem lies elsewhere in your code. That snippet works fine for me, when spurious () removed.
Best Answer