Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

fatal Jerryscript Error: ERR_REF_COUNT_LIMIT

This error is caused by document.getElementById() executed in the long loop. Got rid of this error when cached all the references to SVG elements. That's really weird and most likely is a bug.

 

So, what does this error mean exactly? And what sort of GC is being used in Jerryscript?

Best Answer
7 REPLIES 7

@JonFitbit, please, answer this question, if you don't mind. It's important for everyone who would take the Fitbit SDK serious.

Best Answer
0 Votes

Ok, looks like I found an answer. GC uses tri-color mark-and-sweep algorithm, while objects still have 10-bits reference counters for the hard references. Thus, there could be no more than 1024 references to an object.


Looks like `document.getElemebtById()` call increments the reference counter for the DOM element, which finally causes this exception if you query elements every time you update the UI. The solution is to cache DOM references.

Hope that will help other people who will encounter the same problem. And sooner or later, they will :).

Best Answer

Hey, I am getting this error as well. Can you tell me how do you cache the references to SVG elements in fitbit SDK?

Best Answer
0 Votes
const $el = document.getElementById( 'id' );

Do it once on the top level, and then use $el everywhere. Do not call getElementById every time you have the UI update.

Best Answer

Can you provide a short example of how this is used? Or point me to someplace that may have one?

Best Answer
0 Votes

@gaperton- Also got this fatal Jerryscript Error: ERR_REF_COUNT_LIMIT condition.

 

It turned out that a clock was using the me.appTimeoutEnabled.

Author | ch, passion for improvement.

Best Answer
0 Votes

@gaperton- Also got this fatal Jerryscript Error: ERR_REF_COUNT_LIMIT condition.

 

It turned out to be a touch pad entry error resulting in a clearInterval() with no variable.

Author | ch, passion for improvement.

Best Answer
0 Votes