Sketchfab Forum

Many memory leaks in Sketchfab viewer causing frequent garbage collector pauses and framedrops, especially in WebVR

(Andgokevin) #1

Profiled in Firefox. In a Vive on a machine with a GTX 1080, there are frequent garbage collector pauses caused by memory leaks in the viewer which causes discomfort in VR. Below are frequent memory allocations that can be avoided by reusing arrays and objects:

Adds up to over 35MB of avoidable memory allocation per second.

(Stephomi) #2

Thanks for the report.
Was it on a particular model?

We are doing almost 0 allocations at runtime except for CPU intersection hit on VR (which is usually limited to 2-3 intersections per frame on most models) and maybe a few other things.

The allocations are probably internally handled by the js engine (typically “sort” beging second is fishy).

(Andgokevin) #3

Alright, false alarm then! I think it might have been started recently reporting in-engine allocations. Sorry and thanks for the response.

(Rémy Bouquet) #4

I couldn’t reproduce the issue.
I’d like to dig more into it. I can’t really figure out from your screenshot how you found this 35mb/second figure, but it’s clear that there are regular frame drops from the top chart. Though, even if it seems plausible, it’s not obvious to me that the GC is the cause of these frame drops. Could you give us more information please?
On what amount of time was this record taken? And most importantly, with what model?

Note, that we give a particular attention to do minimal object instantiation in the update loop, but if there is a particular code path where it’s not the case, we want to find it and fix it.

(Andgokevin) #5

Yeah, it may not be GC. It’s just an occasional stutter that I incorrectly assumed was memory.

I just added up the bytes, the data in the table is from a 1 second slice of an about 15 second recording. In the headset on a Vive with a 1080 and a two-year old i5, I do notice a stutter every few seconds or so for example from the VR showcase:

  • Apollo 11
  • Destroyed Subway

Are there any models you recommend me taking a look at that should be buttery smooth?

(Rémy Bouquet) #6

That’s bytes not kb isn’t it? So that’s 35kb not mb, which is definitely manageable.

Anyway I definitely think memory is not the issue. But there is still an issue.
Do you only use firefox for your tests? I use chrome 64 with the proper flags set, it could be interesting to see if you have the same stutters.
I’ll try the scenes you posted.
I’ve seen your other posts about VR, I’ll answer in them.

(Andgokevin) #7

D’oh! Yeah, my error.

Yeah, Firefox. I will try in Chrome and compare. It could just be Firefox.

(Andgokevin) #8

On Chrome Canary (66) trying Apollo 11 VR, I do get some stutters turning my head back and forth. Like once every second or two.