Memory management in VMODS: sp->ws vs. sp->wrk->ws

Lasse Karstensen lkarsten at varnish-software.com
Tue Nov 5 15:47:44 CET 2013


On Wed, Oct 30, 2013 at 05:33:19PM +0100, Carlos Abalde wrote:
> After reading all the available documentation and also reviewing implementations of almost all VMODs in https://www.varnish-cache.org/vmods, I'm not sure what is the difference between using sp->ws and sp->wrk->ws when allocating memory in a VMOD method. It seems sp->wrk->sp is the way to go when using WS_Reserve() and WS_Release(). However, when using WS_Alloc() or WS_Dup() I've seen modules using both sp->ws and sp->wrk->sp. I guess it's not a random choice, but I haven't been able to identify any rule.
> Is there any difference? Any hint on when to use sp->ws and when sp->wrk->sp?

Hi Carlos.

Use sp->ws.

In the case of the request being waitinglisted, it will be wrk-less until woken
up again.


-- 
With regards,
Lasse Karstensen
Varnish Software AS



More information about the varnish-dev mailing list