Skip to content

Conversation

@d-v-b
Copy link
Contributor

@d-v-b d-v-b commented Jan 29, 2026

This PR adds a new managed memory store class (ManagedMemoryStore) that allows requesting in-memory stores with URL syntax like "memory://my-store/" That's the upside.

The downside is that users can't use their own mutable mappings with this store, because we can't make weak references to generic mutable mappings, and so tracking user-defined mutable mappings would keep them from being garbage collected. Instead, instances of ManagedMemoryStore are constructed with name and path parameters.

A note about pickling: ManagedMemoryStore can be pickled, but if it's unpickled in a separate process from where it was created, an exception is raised. Otherwise, writes in a multiprocessing context would appear successful when in fact they were writing to totally separate stores. I don't think there are any threading issues to worry about, but someone who knows more than me should check that.

Basic usage:

zarr.create_array("memory://foo", shape=(10,), dtype='int8')
# <Array memory://foo shape=(10,) dtype=int8>

closes #2906

d-v-b added 4 commits January 29, 2026 17:19
…ctionaries to manage memory-based zarr storage.

Instances of `ManagedMemoryStore` have a URL representation based on the `id` of the backing dict, e.g. `memory://<id>/`.
This means the same memory-backed store can be accessed without passing an explicit store reference.
Ensure that `ManagedMemoryStore` names do not contain the separator character "/"
Ensure that `ManagedMemoryStore` instances are tied the PID of the creating process
@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Jan 29, 2026
@d-v-b d-v-b marked this pull request as ready for review January 29, 2026 20:54
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deterministic memorystore names

1 participant