The DN hearbeat loop looks roughly like this:
The trouble is that since we sleep for exactly the heartbeat interval, and then check to see if we have waited more than that heartbeat interval, we will very often have waited exactly the heartbeat interval (in millis), and not more than it. In this case we will skip actually performing the heartbeat and will calculcate timeToWait as being 0ms. The DN heartbeat loop will then loop tightly for 1ms. The solution is just to change the ">" in the code above to ">=".