spacerocks icon indicating copy to clipboard operation
spacerocks copied to clipboard

exhaustUpdate causes memory usage to increase rapidly

Open SamiraAtMicrosoft opened this issue 7 years ago • 2 comments

Looking at the Memory usage in Task Manager (under the Performance tab in Windows 10) I observed that the committed memory increases rapidly when playing the game.

The issue is not present if I remove the lines of code that update geometry.vertices inside player.js's exhaustUpdate function.

I observed this on both Chrome and Edge.

SamiraAtMicrosoft avatar Aug 13 '18 16:08 SamiraAtMicrosoft

Good find! I don’t have time to investigate further at the moment; do you think it’s repairable? (I’d rather fix the issue or find a more efficient means of updating the exhaust trail rather than disabling it altogether.)

stewdio avatar Aug 13 '18 17:08 stewdio

I think this can be answered once the root cause is discovered. I did some experimentation by modifying exhaustUpdate to simply:

        function exhaustUpdate( side ){
            const
            arm      = player.arms[ side ],
            engine   = arm.engine,
            enginePositionNow = engine.localToWorld( new THREE.Vector3() ).sub( M.three.world.position ),
            exhaust  = arm.exhaust,
            geometry = exhaust.geometry

            geometry.elementsNeedUpdate = true
        }

And the memory usage continues to climb. However, removing the call to elementsNeedUpdate results in stable memory usage.

Perhaps there is an underlying issue with THREE.CylinderGeometry or how it is meant to be used?

SamiraAtMicrosoft avatar Aug 15 '18 17:08 SamiraAtMicrosoft