I'm not competent enough to discuss why does it happen, but while using the fpsHUD i've noticed the lag spikes every time a container was opened (or more correctly when closed). Like you said that error appears every time a character window is opened or even when you press escape(while using a custom hud that uses playerpreview).
I've pinpointed the problem towards this part of the code being placed under the compass part of the HUD, since compared to statbar it stops rendering every time a container is opened and reappears when closed.
From my limited understanding this is a very 'hacky' way of rendering a window beyond the screen view for the sake of updating certain stats in realtime, unfortunately that window seems to throw errors every time it's rendered, and it seemed a bit problematic to close/render all the time.
I think that i didn't manage to state that placing anything else under compass side will create lag... So i'm not really sure why this post was even mentioned here. Especially since i personally use Riles-Hud as a base with few modifications from different projects posted on the forum and i never had any lag with it.
For the sake of 'inspiration' here's what i personally ended up with: