gossipd: use explicit destructor for struct chan.

Each destructor2 costs 40 bytes, and struct chan is only 120 bytes.  So
this drops our memory usage quite a bit:

MCP bench results change:
   -vsz_kb:580004-580016(580006+/-4.8)
   +vsz_kb:533148

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-05-21 16:43:28 +09:30
parent 59e75f1b2c
commit d1f43d993a
8 changed files with 57 additions and 16 deletions

View File

@@ -197,6 +197,13 @@ int main(void)
last_fee = fee;
}
/* Since we omitted destructors on these, clean up manually */
u64 idx;
for (struct chan *chan = uintmap_first(&rstate->chanmap, &idx);
chan;
chan = uintmap_after(&rstate->chanmap, &idx))
free_chan(rstate, chan);
tal_free(tmpctx);
secp256k1_context_destroy(secp256k1_ctx);
return 0;