Patch: Use calloc instead of malloc when running out of VSM space (common_vsm.c)

Poul-Henning Kamp phk at
Tue Mar 8 13:26:47 CET 2016

In message <CAJV_h0YVCRfTOFk=6N3H9jNxnrXM05ht2pQkyJ-FY-LGfu1H_g at>
, Federico Schwindt writes:

>We use calloc in many places, I do wonder how many of them do really need
>it. The downside of using calloc when is not really needed is that by
>zeroing the memory you end up with resident memory and not virtual, which
>in turn might lead to swapping.

This is almost always intentional, as we generally do not over-allocate.

The exception is the malloc stevedore where we do.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-dev mailing list