02-16-2019 06:33 - edited 02-16-2019 06:33
02-16-2019 06:33 - edited 02-16-2019 06:33
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,
02-16-2019 11:45
02-16-2019 11:45
This is just a guess, but try deleting the () in noSignal().
02-16-2019 14:58
02-16-2019 14:58
02-16-2019 15:31
02-16-2019 15:31
A 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.
02-17-2019 16:14 - edited 02-17-2019 16:18
02-17-2019 16:14 - edited 02-17-2019 16:18
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.
02-18-2019 07:42
02-18-2019 07:42
02-22-2019 23:38 - edited 02-22-2019 23:40
02-22-2019 23:38 - edited 02-22-2019 23:40
> 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.
02-22-2019 23:47 - edited 02-22-2019 23:52
02-22-2019 23:47 - edited 02-22-2019 23:52
I suspect the problem lies elsewhere in your code. That snippet works fine for me, when spurious () removed.