Mapbox-gl-js: Possible memory leak when setData with GeoJSON

Created on 7 Sep 2017  路  4Comments  路  Source: mapbox/mapbox-gl-js

mapbox-gl-js version: 0.39.1

Steps to Trigger Behavior

  1. open https://alex2wong.github.io/mapbox-plugins/examples/hexgrid/
  2. try dragging and zooming the map
  3. updating hexgrid layer data would cause memory increase concerning Actor.js
  4. wait several mins, the memory would go up.. to 2GB or 3GB util crash.

Expected Behavior

memory retain normal.

Actual Behavior

this tab's memory cost somtimes may increase to to 1GB

Use Chrome(v61) performance debug tool to track the call stack, it seems geojson_source related code would call actor.js to perform multi-thread calculation.. I've heard about actor model somtimes would go out of control and create many subactor which means it may cause memory leak. Correct me if I am wrong.

Actually ,updating to latest mapbox-gl.js performs better than old version. But it still has something wrong with the memory, and the map would gets slow or crash when memory leaks.

memoryleak4

Thanks! mapbox is brilliant : )

performance

Most helpful comment

@jfirebaugh yes, you're right, the GC have collect some of mapbox related object normally, which indicated by the sawtooth pattern. This shows the js heap( max value 168Mb) seems right. But the total memory (over 3GB) this tab occupied keeps increasing as time goes by. attach chrome task screenshot:

memory_jsheap

Do you have any idea why the total memory keeps increasing ? I just drag and zoom for a while.

All 4 comments

I'm not able to reproduce the behavior you are describing. I see a sawtooth pattern to memory use, where growth is followed by a GC event:

image

@jfirebaugh yes, you're right, the GC have collect some of mapbox related object normally, which indicated by the sawtooth pattern. This shows the js heap( max value 168Mb) seems right. But the total memory (over 3GB) this tab occupied keeps increasing as time goes by. attach chrome task screenshot:

memory_jsheap

Do you have any idea why the total memory keeps increasing ? I just drag and zoom for a while.

@alex2wong Did this issue fixed for you. For me not 馃槥.

closed since this does not happen frequently in later tests. thx

Was this page helpful?
0 / 5 - 0 ratings