adds u3m_reclaim to clear persistent caches in vere

This commit is contained in:
Joe Bryan 2019-01-21 20:02:41 -05:00
parent 1087de003f
commit ffdc465085
2 changed files with 35 additions and 0 deletions

View File

@ -125,3 +125,8 @@
*/
void
u3m_wall(u3_noun wol);
/* u3m_reclaim: clear persistent caches to reclaim memory
*/
void
u3m_reclaim(void);

View File

@ -1723,3 +1723,33 @@ u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c,
u3n_ream();
}
}
/* u3m_reclaim: clear persistent caches to reclaim memory
*/
void
u3m_reclaim(void)
{
// clear the memoization cache
//
u3h_free(u3R->cax.har_p);
u3R->cax.har_p = u3h_new();
// clear the bytecode cache
//
u3h_free(u3R->byc.har_p);
u3R->byc.har_p = u3h_new();
// clear the jet battery hash cache
//
u3h_free(u3R->jed.bas_p);
u3R->jed.bas_p = u3h_new();
// clear the jet hank cache
//
u3h_free(u3R->jed.han_p);
u3R->jed.han_p = u3h_new();
// clear the u3v_wish cache
u3z(u3A->yot);
u3A->yot = u3_nul;
}