<p dir="ltr">Or WS_Alloc if you know how much you need to allocate beforehand. </p>
<div class="gmail_quote">On May 19, 2013 7:26 PM, "Jammy" <<a href="mailto:jammy.linux@gmail.com">jammy.linux@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div>Yes, it will result in memory leakage.</div><div><br></div><div>I recommend to use WS_Reserve to allocate your memory within your VMOD.</div><div><br></div><div>Best regards</div>
<div><br></div><div><br></div><div><div>On 19 May, 2013, at 4:59 PM, flygoast wrote:</div><br><blockquote type="cite"><div style="line-height:1.7;font-size:14px;font-family:arial"><p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">
hi, guys,</p><p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">I'm newbie in varnish vmod development.</p>
<p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">I'am comfusing when I return a char * pointting to a block of memory malloced from heap, Whether resultting in a memory leak?</p>
<p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">Such as:</p><p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">
char *</p><p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">vmod_foo(struct sess *sp, struct vmod_priv *priv)</p>
<p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">{</p><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">return strdup("foo");</p>
</blockquote><p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">}</p><p style="margin:0px 10px 1.5em 0px;padding:0px;border:0px;font-family:'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;vertical-align:baseline;color:rgb(34,34,34)">
Thank you!</p></div><br><br><span title="neteasefooter"><span></span></span>_______________________________________________<br>varnish-dev mailing list<br><a href="mailto:varnish-dev@varnish-cache.org" target="_blank">varnish-dev@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev</a></blockquote></div><br><div>
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<div><div>----------------------------------</div><div>Best wishes,</div><div>Jammy</div></div><div><br></div><div><br></div></div></span><br></div></span><br></span><br>
</div>
<br></div><br>_______________________________________________<br>
varnish-dev mailing list<br>
<a href="mailto:varnish-dev@varnish-cache.org">varnish-dev@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev</a><br></blockquote></div>