This PR aims to fix a potential memory leak issue in nodebuffer.
Rationale
In #121 we introduced a potential memory leak risk. When the block height difference between stateid and truncate tail in the differlayer exceeds the limit size (90,000), we attempt to trigger a truncate. However, to prevent repeated deletions, we added a condition. If the condition is not met, we do not perform the truncate and return directly, waiting until the next trigger. Before returning, we forgot to clear the difflayer cache, which causes the difflayer to be unrecoverable, resulting in a memory leak. The diagram shows the monitoring of this part of the memory (pathdb_difflayer_hashcache_size).
The metric shows the memory usage of difflayer before and after enabling this fix.
Description
This PR aims to fix a potential memory leak issue in nodebuffer.
Rationale
In #121 we introduced a potential memory leak risk. When the block height difference between stateid and truncate tail in the differlayer exceeds the limit size (90,000), we attempt to trigger a truncate. However, to prevent repeated deletions, we added a condition. If the condition is not met, we do not perform the truncate and return directly, waiting until the next trigger. Before returning, we forgot to clear the difflayer cache, which causes the difflayer to be unrecoverable, resulting in a memory leak. The diagram shows the monitoring of this part of the memory (pathdb_difflayer_hashcache_size).
The metric shows the memory usage of difflayer before and after enabling this fix.
Example
N/A
Changes