With
xbuf_xcat(get_reply(argv), replycontent)
, RSS value grows Withxbuf_xcat(get_reply(argv), "value=1")
, memory usage is stable
As shown by the working xbuf_xcat(reply, "value=1")
, G-WAN automatically recycles the memory allocated for the reply
xbuffer, so this is not the problem.
Your problem rather comes from how you are generating the replycontent
.
And this portion of the code is missing in your question. If you are asking for assistance, it might help to show what you are doing.
UPDATE (following the source code disclosure in the question)
Your code is using a small buffer allocated on the stack so it does not change the memory usage of G-WAN.
Besides, you should directly write into the 'reply' xbuffer rather than into a temporary buffer which is then copied into the 'reply' xbuffer - and to make such a copy, you should rather use xbuf_cat() or xbuf_ncat(), but not xbuf_xcat().
Given this (undamaging but pointless) code, the "sudden raise" of memory you have seen could come from problems in other scripts (handlers? maintenance script?, OS/VM configuration?), or from the tests you make if you are using very high concurrencies.
Maybe you could try writing G-WAN servlets in another programming language than C (G-WAN supports 15 different programming languages, including Java, C#, Perl, Python, Ruby, etc.), this would help you to avoid most memory allocation pitfalls.