Rusty Russell
edb386558c
lightningd: avoid high memory usage spike at startup.
I saw this while watching top, and tracked it down. We load all the
plugins to checksum them at startup:
```
$ ms_print massif.out.3312805 | head -n 50
--------------------------------------------------------------------------------
Command: lightningd/lightningd.real --developer --log-level=trace --cltv-delta=6 --cltv-final=5 --watchtime-blocks=5 --rescan=1 --disable-dns --lightning-dir=/tmp/ltests-roazlc8h/test_xpay_fake_channeld_1/lightning-1/ --addr=127.0.0.1:46337 --allow-deprecated-apis=false --network=regtest --ignore-fee-limits=false --bitcoin-rpcuser=rpcuser --bitcoin-rpcpassword=rpcpass --bitcoin-datadir=/tmp/ltests-roazlc8h/test_xpay_fake_channeld_1/lightning-1/ --dev-fast-gossip --dev-bitcoind-poll=1 --log-file=- --log-file=/tmp/ltests-roazlc8h/test_xpay_fake_channeld_1/lightning-1/log --log-prefix=lightningd-1 --dev-fail-on-subdaemon-fail --dev-no-reconnect --autoconnect-seeker-peers=0 --subdaemon=channeld:../tests/plugins/channeld_fakenet --dev-throttle-gossip --grpc-port=37819 --dev-crash-after=3600 --bitcoin-rpcport=51623
Massif arguments: (none)
ms_print arguments: massif.out.3312805
--------------------------------------------------------------------------------
MB
446.5^#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|#
|# :: : ::@@:@:::::::::::::::::::::::::::@@::::::::::::::@::::@:::::::
0 +----------------------------------------------------------------------->Gi
0 75.66
Number of snapshots: 57
Detailed snapshots: [1 (peak), 2, 10, 12, 33, 45, 49]
--------------------------------------------------------------------------------
n time(i) total(B) useful-heap(B) extra-heap(B) stacks(B)
--------------------------------------------------------------------------------
0 0 0 0 0 0
1 295,677,530 468,189,872 447,087,069 21,102,803 0
95.49% (447,087,069B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
->95.35% (446,440,727B) 0x2EFB99: tal_resize_ (tal.c:755)
| ->94.23% (441,180,860B) 0x2EBCD1: grab_fd (grab_file.c:45)
| | ->94.23% (441,180,860B) 0x2EBD54: grab_file (grab_file.c:63)
| | ->94.23% (441,180,860B) 0x1A5CF7: file_checksum (plugin.c:315)
| | ->94.23% (441,180,860B) 0x1A5EF1: plugin_register (plugin.c:355)
| | ->94.23% (441,180,860B) 0x1AC62E: plugins_set_builtin_plugins_dir (plugin.c:2532)
| | ->94.23% (441,180,860B) 0x16D614: find_subdaemons_and_plugins (lightningd.c:569)
| | ->94.23% (441,180,860B) 0x16E9A1: main (lightningd.c:1226)
| |
| ->01.11% (5,219,417B) 0x2EBC32: grab_fd (grab_file.c:38)
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-24 13:59:58 +10:30
..
2025-03-12 09:26:08 +10:30
2024-11-26 14:49:36 +10:30
2023-10-27 11:19:56 +10:30
2025-03-12 09:26:08 +10:30
2024-06-24 17:26:11 +09:30
2025-01-21 09:18:25 +10:30
2025-01-21 09:18:25 +10:30
2025-03-19 17:32:26 +01:00
2024-06-19 15:54:24 +09:30
2025-03-18 14:30:58 +10:30
2024-01-31 14:47:33 +10:30
2024-09-21 06:20:18 +09:30
2025-02-22 11:51:54 -06:00
2025-02-22 11:51:54 -06:00
2024-09-19 12:16:53 +09:30
2024-01-31 14:47:33 +10:30
2025-03-18 14:30:58 +10:30
2024-11-25 20:23:21 +10:30
2024-07-23 09:54:47 +09:30
2025-03-12 09:26:08 +10:30
2025-02-10 19:19:12 -06:00
2024-11-25 15:39:13 +10:30
2024-12-20 15:36:07 +10:30
2025-03-18 14:30:58 +10:30
2024-06-19 15:54:24 +09:30
2024-03-25 15:02:35 +10:30
2024-10-26 09:51:20 +02:00
2024-01-26 10:30:22 +10:30
2024-11-25 15:39:13 +10:30
2024-01-31 14:47:33 +10:30
2024-07-23 09:54:47 +09:30
2024-03-20 13:51:48 +10:30
2024-11-21 14:15:36 +10:30
2023-08-08 14:31:47 +09:30
2024-10-16 07:14:32 +10:30
2025-01-21 09:18:25 +10:30
2024-10-27 13:57:50 +11:00
2025-01-21 09:18:25 +10:30
2025-03-12 09:26:08 +10:30
2023-10-28 15:48:26 +10:30
2025-03-12 09:26:08 +10:30
2025-03-12 09:26:08 +10:30
2025-03-12 09:26:08 +10:30
2025-03-12 09:26:08 +10:30
2023-07-19 19:13:57 +09:30
2023-07-19 19:13:57 +09:30
2025-01-21 09:18:25 +10:30
2024-12-16 09:48:51 +10:30
2024-08-01 12:31:48 +09:30
2025-01-21 09:18:25 +10:30
2025-03-12 09:26:08 +10:30
2025-02-12 12:54:10 +10:30
2025-02-11 20:19:01 -06:00
2025-03-02 16:06:34 -06:00
2025-03-12 09:26:08 +10:30
2024-05-09 16:14:23 -05:00
2023-10-23 15:48:50 +10:30
2025-02-22 11:51:54 -06:00
2024-06-19 15:54:24 +09:30
2025-03-18 14:30:58 +10:30
2025-03-12 09:26:08 +10:30
2024-12-17 15:59:30 +10:30
2024-10-27 13:57:50 +11:00
2025-03-24 13:59:58 +10:30
2025-02-26 10:22:03 -06:00
2025-02-26 10:22:03 -06:00
2024-11-20 12:29:27 +01:00
2024-10-27 13:57:50 +11:00
2024-07-31 14:42:58 +09:30
2024-11-18 11:03:26 +10:30
2025-03-12 09:26:08 +10:30
2025-03-24 13:59:58 +10:30
2025-03-12 09:26:08 +10:30
2024-09-19 12:16:53 +09:30
2025-02-05 16:43:09 -06:00
2023-09-12 15:19:02 +09:30
2025-03-12 09:26:08 +10:30
2024-12-16 09:48:51 +10:30
2024-11-13 14:44:03 +10:30
2024-07-31 14:42:58 +09:30
2023-10-28 15:48:26 +10:30
2025-01-21 09:18:25 +10:30
2025-01-21 09:18:25 +10:30