How can I determine how much garbage is being created by my JS code running on Coherent?

I’ve been tuning performance and I’d like to understand how much memory churn is created by my JS avionics. The coherent debugger timeline tool has some profiling capability, but I don’t see anything to indicate how much memory I’m using each frame or exactly when GC pauses are occurring.

Is there any way to see allocations or GC statistics? This would be really helpful.

2 Likes

Bump. I was able to optimize my avionics by using isolation and estimation but it would be preferable to validate the work by monitoring the GC cycles and heap usage.

The general advice to optimize is workable but direct confirmation of memory pressure would allow for much higher confidence in the quality of the avionics and their impact on the rest of the sim.

3 Likes

I think my aircraft glass cockpit is using too much memory. When I unload panel.cfg and compare in task manager, it’s several GB lower and I want to dig into this and relive pressure on the sim.

I want to optimize this but there is no way to determine how much sim memory is allocated to each instrument.

So the only approach would be to

  1. Restart the sim over and over and use task manager itself as a proxy for total memory usage, holding all other factors constant and testing avionics changes
  2. Isolate instruments (test one of perhaps 20 at a time).

This is really slow.

If we could get a total count of bytes per context that would be helpful. If we could get the total bytes allocated by Coherent then we could at least not have to hold all other factors constant to make an assessment on whether memory usage is high or low.

Using the Coherent Debugger you can get some insight into memory allocations.
On the Timelines tab click the “Edit” button.
image
Then select “JavaScript Allocations”
image

This way you can take snapshots and compare those to see allocations between the two.
Often memory pressure causing frequent GCs happens a lot when especially strings are rebuilt and thrown away every frame.

About the overall memory consumption you should also look into the resolution and amount of layers of your instrument. Each layer will create a texture of its size which can be quite costly at high resolutions.
You can see the layers on the sidebar of the Elements tab.
image

3 Likes