Skip to content

Bug: Workspace rebuild_catalog() Loads All Full Documents, Creating Memory Risk #86

@zTgx

Description

@zTgx

Description

When catalog.bin is corrupted or missing, Workspace::rebuild_catalog() iterates through all documents and calls load() to load the complete PersistedDocument (including DocumentTree + NavigationIndex + ReasoningIndex), solely to extract the DocCard.

For workspace mode (100+ documents), this means holding many complete documents in memory simultaneously.

Related Code

rust/src/storage/workspace.rsrebuild_catalog() method

Suggested Fix

  1. Stream processing: Load documents one by one, extract the DocCard, and release the document.
  2. Alternatively, implement a lightweight DocCard extraction method on PersistedDocument to avoid deserializing the full tree.
  3. Add memory usage monitoring logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions