mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 15:44:21 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user