mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-10 04:12:48 +02:00
MINOR: pattern: add pat_ref_purge_older() to purge old entries
This function will be usable to purge at most a specified number of old entries from a reference. Entries are declared old if their generation number is in the past compared to the one passed in argument. This will ease removal of early entries when new ones have been appended. We also call malloc_trim() when available, at the end of the series, because this is one place where there is a lot of memory to save. Reloads of 1M IP addresses used in an ACL made the process grow up to 1.7 GB RSS after 10 reloads and roughly stabilize there without this call, versus only 260 MB when the call is present. Sadly there is no direct equivalent for jemalloc, which stabilizes around 800MB-1GB.
This commit is contained in:
@@ -192,6 +192,7 @@ void pat_ref_delete_by_ptr(struct pat_ref *ref, struct pat_ref_elt *elt);
|
||||
int pat_ref_delete_by_id(struct pat_ref *ref, struct pat_ref_elt *refelt);
|
||||
int pat_ref_prune(struct pat_ref *ref);
|
||||
int pat_ref_commit(struct pat_ref *ref, struct pat_ref_elt *elt, char **err);
|
||||
int pat_ref_purge_older(struct pat_ref *ref, unsigned int oldest, int budget);
|
||||
void pat_ref_reload(struct pat_ref *ref, struct pat_ref *replace);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user