Skip to content

[Feature Request] Allow disabling or evicting of the descriptorCache #4555

@pcase-study

Description

@pcase-study

The descriptorCache in observableObject.ts appears to trade a small amount of memory for performance when initializing an observable, creating one cached descriptor for every unique object key that mobx sees.

We encountered a situation where a library was using a plain java object as a Map, with UUIDs as the key. This wasn't causing any problems for end users, but on our SSR server the infinitely-many different UUIDs resulted in Mobx caching infinitely-many descriptors. This leaked memory with no way to recover it.

While we were able to patch the library to use an actual Map object to coax mobx into using ObservableMap instead of the ObservableObjectAdministration, it would be nice to have a way to either disable the descriptorCache entirely or have a utility method for clearing it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions