user = new_helloworld_user()

will allocate memory for each pass through the loop.

Martijn

On Mon, Sep 12, 2011 at 11:19 PM, Thomas Marsh <[email protected]> wrote:
> Hello all,
>
> I have a question about memory consumption in the Etch/C runtime based on 
> behavior we are seeing within our C client. I have modified the C 
> implementation of the HelloWorld example in the distribution to run an 
> infinite loop of requests:
>
> In the main() routine of helloworld_client_main.c:
>
>                ...
>                while (1) {
>                                user = new_helloworld_user();
>                                user->id = 5;
>                                user->name = new_stringw(L"User");
>                                result = remote->say_hello(remote, user);
>                                if (is_etch_exception(result)) {
>                                                ...
>                                }
>                                printf("%S\n", result->v.valw);
>                                etch_object_destroy(result);
>                }
>                ...
>
> While running this, I see that the memory consumption of the client 
> continually grows. (In this example, it grows by about 1 mB every 5 seconds.) 
> I cannot see the memory leak when testing with valgrind, so it would suggest 
> that the leak is in Etch managed memory which is cleared at exit.
>
> My understanding is that the call to remote->say_hello() should delegate 
> responsibility of deallocation of the parameters to the Etch runtime, and 
> that the client code is only responsible for deallocating the result object. 
> The memory use should be stable within this tight loop. Can anyone comment on 
> the potential cause of the memory consumption?
>
> Thanks, and best regards,
>
> --thomas
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

Reply via email to