Questions regarding memory footprint
2007-12-12 by Jim Carroll
We've noticed that over time (and in our configuration), the memory
consumption of milter-greylist has grown to over 400 MB per server instance.
It would seem from a quick code scan, that this is mainly the result of the
sizeof(struct rcpt) (defined in milter-greylist.h).
struct rcpt {
char r_addr[ADDRLEN + 1];
LIST_ENTRY(rcpt) r_list;
};
The ADDRLEN macro is defined in dump.h and based on RFC-2821, it is set to a
value of 324. Our database is 2.2 million entries, which is why I believe
we're consuming in the area of 400 MB.
I would like to reduce the memory footprint of milter-greylist.
In the long run, perhaps the best approach is to refactor the code to use a
char* for r_addr, and malloc() new entries based on the actual length of the
address.
But as a quick hack, I'm considering just dropping ADDRLEN to 100.
Does anyone know whether this would break anything too severely?
Thanks
Jim C.