-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Summary
Core components (Ledger, CRDT, Blockstore, Loader) have circular parent references that prevent garbage collection. This causes memory leaks when databases are opened and closed repeatedly.
Problem
The current architecture has:
CRDTholds reference toLedgerBlockstoreholds reference toCRDTLoaderholds references to multiple components- These circular references prevent cleanup when
close()is called
Repeatedly opening and closing databases causes unbounded memory growth.
Proposed Solution
- Define clean interfaces in
core/types/:ILedger,ICRDT,IBlockstore,ILoader
- Extract responsibilities from monolithic
Loader:BlockLoader- block loading/cachingMetaLoader- metadata managementCompactionManager- compaction logic
- Replace parent object references with IDs
- Create
ComponentRegistryfor service lookup - Add event-based communication between components
Expected Outcomes
- Closing database releases all associated resources
- No references remain to closed database objects
- Components testable in isolation
- Memory stabilizes after 1000 open/close cycles
Metadata
Metadata
Assignees
Labels
No labels