mirror of
https://github.com/urbit/shrub.git
synced 2025-01-02 09:32:29 +03:00
refactors u3m_reclaim, plugging memory leaks
This commit is contained in:
parent
414e760fd1
commit
2b8a7392ad
@ -262,6 +262,11 @@
|
||||
c3_w
|
||||
u3j_mark(FILE* fil_u);
|
||||
|
||||
/* u3j_free_hank(): free an entry from the hank cache.
|
||||
*/
|
||||
void
|
||||
u3j_free_hank(u3_noun kev);
|
||||
|
||||
/* u3j_free(): free jet state.
|
||||
*/
|
||||
void
|
||||
|
@ -2272,10 +2272,10 @@ u3j_mark(FILE* fil_u)
|
||||
return u3a_maid(fil_u, "total jet stuff", tot_w);
|
||||
}
|
||||
|
||||
/* _cj_free_hank(): free hank cache.
|
||||
/* u3j_free_hank(): free an entry from the hank cache.
|
||||
*/
|
||||
static void
|
||||
_cj_free_hank(u3_noun kev)
|
||||
void
|
||||
u3j_free_hank(u3_noun kev)
|
||||
{
|
||||
_cj_hank* han_u = u3to(_cj_hank, u3t(kev));
|
||||
if ( u3_none != han_u->hax ) {
|
||||
@ -2290,7 +2290,7 @@ _cj_free_hank(u3_noun kev)
|
||||
void
|
||||
u3j_free(void)
|
||||
{
|
||||
u3h_walk(u3R->jed.han_p, _cj_free_hank);
|
||||
u3h_walk(u3R->jed.han_p, u3j_free_hank);
|
||||
u3h_free(u3R->jed.war_p);
|
||||
u3h_free(u3R->jed.cod_p);
|
||||
u3h_free(u3R->jed.han_p);
|
||||
|
@ -1729,27 +1729,38 @@ u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c,
|
||||
void
|
||||
u3m_reclaim(void)
|
||||
{
|
||||
// clear the u3v_wish cache
|
||||
//
|
||||
u3z(u3A->yot);
|
||||
u3A->yot = u3_nul;
|
||||
|
||||
// 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();
|
||||
|
||||
// XX we can't clear the warm jet state
|
||||
// -- _cj_nail expects it to be present ...
|
||||
//
|
||||
// u3h_free(u3R->jed.war_p);
|
||||
// u3R->jed.war_p = u3h_new();
|
||||
|
||||
// clear the jet hank cache
|
||||
//
|
||||
u3h_walk(u3R->jed.han_p, u3j_free_hank);
|
||||
u3h_free(u3R->jed.han_p);
|
||||
u3R->jed.han_p = u3h_new();
|
||||
|
||||
// clear the u3v_wish cache
|
||||
u3z(u3A->yot);
|
||||
u3A->yot = u3_nul;
|
||||
// clear the bytecode cache
|
||||
//
|
||||
// We can't just u3h_free() -- the value is a post to a u3n_prog.
|
||||
// Note that this requires that the hank cache also be freed.
|
||||
//
|
||||
u3n_free();
|
||||
u3R->byc.har_p = u3h_new();
|
||||
}
|
||||
|
@ -2567,7 +2567,7 @@ u3n_mark(FILE* fil_u)
|
||||
return u3a_maid(fil_u, "total nock stuff", bam_w + har_w);
|
||||
}
|
||||
|
||||
/* _n_feb(): u3h_walk helper for u3n_bree
|
||||
/* _n_feb(): u3h_walk helper for u3n_free
|
||||
*/
|
||||
static void
|
||||
_n_feb(u3_noun kev)
|
||||
|
Loading…
Reference in New Issue
Block a user