Fix and enhance memory usage regarding log table #1783
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Found by: michaelortmann
Patch by: michaelortmann
Fixes:
One-line summary:
Enhance memory usage regarding log table - Fix regression since eggdrop 1.9.0rc1
Additional description (if needed):
This PR not only fixes the regression since eggdrop 1.9.0rc1, but makes eggdrop even better than before regarding amount of memory allocation for log table
During eggdrop startup, memory for log tables is allocated:
eggdrop/src/misc.c
Lines 92 to 101 in 341477a
about
max-logs * LOGLINELEN
bytesdefault
max-logs
is20
LOGLINELEN
was rised from1024
to9000
since eggdrop 1.9.0rc120 * 9000 = 180 kbytes
Users probably raise
max-logs
to100
or more in their configuration files so they wont have to care about it anymore, not aware of the memory usage implications.This PR makes eggdrop to still allocate memory for
max-logs
log tables. but only about 56 bytes per table / logfile static.szlast
(last log messages to track repeats) will be allocated (grow) dynamically untilLOGLINELEN
..status
will now show the log table information, similar to socket table (and memory table, if debug enabled)Add MIN() and MAX() to eggdrop.h
Test cases demonstrating functionality (if applicable):
Before:
After: