Skip to content

Avoid retaining GeoJSONSource data on main thread #3220

Description

@jfirebaugh

GeoJSONSource retains any data set via Map#addSource(...) or GeoJSONSource#setData in a _data member. This data is included in the serialized representation of the source, but as far as I can tell, that's unnecessary: the only thing that serialized sources are used for is style validation, which does not care about GeoJSON data.

Because the data is also passed to the worker, we are effectively doubling the memory requirements of GeoJSON sources. We could avoid creating a member variable, or set it to null after sending the data to the worker, which would eliminate this overhead.

Activity

  1. anandthakker commented on Jan 28, 2017

    @anandthakker
    Contributor

    One thing we'll need to resolve is how setStyle's diff should handle GeoJSON sources. As of now, we're doing a deep equality test, which is probably not what we want (see also #4006 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performance ⚡Speed, stability, CPU usage, memory usage, or power usage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions