mvcc-api 1.2.9 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,6 +141,24 @@ sequenceDiagram
|
|
|
141
141
|
> - Children can only see **committed data** at the time of creation.
|
|
142
142
|
> - Snapshots are maintained even if external commits occur after creation.
|
|
143
143
|
|
|
144
|
+
> [!WARNING]
|
|
145
|
+
> **Memory Management**
|
|
146
|
+
>
|
|
147
|
+
> Every transaction created via `createNested()` MUST be finished with either `commit()` or `rollback()`.
|
|
148
|
+
> Internally, the Root transaction tracks all active transactions to determine which old versions can be safely pruned from memory.
|
|
149
|
+
> Failing to close a transaction will prevent the internal Garbage Collection (Pruning) from reclaiming memory, eventually leading to a **Memory Leak**.
|
|
150
|
+
>
|
|
151
|
+
> ```typescript
|
|
152
|
+
> const tx = root.createNested()
|
|
153
|
+
> try {
|
|
154
|
+
> // ... work ...
|
|
155
|
+
> await tx.commit()
|
|
156
|
+
> } finally {
|
|
157
|
+
> // Ensure rollback is called if commit failed or an error occurred
|
|
158
|
+
> if (!tx.committed) tx.rollback()
|
|
159
|
+
> }
|
|
160
|
+
> ```
|
|
161
|
+
|
|
144
162
|
## Conflict Detection
|
|
145
163
|
|
|
146
164
|
Conflicts occur upon commit if transactions have modified the same key.
|