FABRIC-3.10.8 K-8: free the vocabulary indexes and inference outputs at vm_cleanup
The ~3.4 KB/VM heap residual left after K-4 was each dead VM's CONTEXT and FORTH first-character bucket arrays (84 blocks, 3,400 bytes per worker), plus last_inference_outputs. New vocabulary_free_indexes(); both vm_cleanup()s call it and free the outputs. Per-VM residual is now 232 bytes: the registry node (kept by design) and the vm_physics node (open finding). 3-ISA acceptance clean, hash 0x99b01134c3d3049c. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
acea36ea55
commit
f29658a65d
@@ -315,6 +315,15 @@ void vm_cleanup(VM* vm)
|
||||
/* This VM's dictionary lookup index (FABRIC-3.10.8 MC-0c) */
|
||||
vm_dictionary_index_free(vm);
|
||||
|
||||
/* Its vocabulary search indexes, and its last inference outputs
|
||||
* (FABRIC-3.10.8 K-8: neither was freed -- the vocabulary buckets were
|
||||
* ~3.4 KB per dead VM). */
|
||||
vocabulary_free_indexes(vm);
|
||||
if (vm->last_inference_outputs) {
|
||||
vm_host_free(vm, vm->last_inference_outputs);
|
||||
vm->last_inference_outputs = NULL;
|
||||
}
|
||||
|
||||
/* Clean up rolling window of truth */
|
||||
rolling_window_cleanup(&vm->rolling_window);
|
||||
|
||||
|
||||
@@ -398,6 +398,14 @@ void vm_cleanup(VM* vm)
|
||||
/* This VM's dictionary lookup index (FABRIC-3.10.8 MC-0c) */
|
||||
vm_dictionary_index_free(vm);
|
||||
|
||||
/* Its vocabulary search indexes and last inference outputs
|
||||
* (FABRIC-3.10.8 K-8: neither was freed). */
|
||||
vocabulary_free_indexes(vm);
|
||||
if (vm->last_inference_outputs) {
|
||||
sf_free(vm->last_inference_outputs);
|
||||
vm->last_inference_outputs = NULL;
|
||||
}
|
||||
|
||||
/* Clean up rolling window of truth */
|
||||
rolling_window_cleanup(&vm->rolling_window);
|
||||
|
||||
|
||||
@@ -98,4 +98,13 @@ void vocabulary_word_definitions(VM *vm);
|
||||
*/
|
||||
void vocabulary_word_forth(VM *vm);
|
||||
|
||||
/*
|
||||
* @brief Free this VM's vocabulary search indexes (vm_cleanup())
|
||||
* @details FABRIC-3.10.8 K-8: the CONTEXT and FORTH first-character bucket
|
||||
* arrays (vm->vocab.ctx_fc / forth_fc) were never freed -- about
|
||||
* 3.4 KB left behind by every VM that died.
|
||||
* @param vm Pointer to the virtual machine instance
|
||||
*/
|
||||
void vocabulary_free_indexes(VM *vm);
|
||||
|
||||
#endif /* VOCABULARY_WORDS_H */
|
||||
@@ -104,6 +104,17 @@ static void fc_free(DictEntry ***lists, size_t *counts) {
|
||||
}
|
||||
}
|
||||
|
||||
/* FABRIC-3.10.8 K-8: vm_cleanup() calls this -- the two indexes' bucket
|
||||
* arrays were never freed when a VM died (84 blocks, 3,400 bytes, per
|
||||
* worker). */
|
||||
void vocabulary_free_indexes(VM *vm) {
|
||||
if (!vm) return;
|
||||
fc_free(vm->vocab.ctx_fc, vm->vocab.ctx_n);
|
||||
fc_free(vm->vocab.forth_fc, vm->vocab.forth_n);
|
||||
vm->vocab.ctx_cached_head = NULL;
|
||||
vm->vocab.forth_cached_head = NULL;
|
||||
}
|
||||
|
||||
static void fc_rebuild(DictEntry *head, DictEntry ***lists, size_t *counts, DictEntry **cached_head) {
|
||||
fc_free(lists, counts);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user