On 6/9/06, Tiago Loureiro <[EMAIL PROTECTED]> wrote: > Thanks for answering my doubts... however, I the problem remains. You have > tried exactly the code I have supplied on the mailing list? Because running > that same test, memory starts climbing up to 40 megs and further... ( by the > way, by simply starting the program I have a mem consumption of 12 megs )
I used your program, I just added one printf() and #include <sofia-sip/nua.h> there. And I think I used TCP while you use UDP. > Surprisingly, memory consumption did stabilize, at 74 megs! However, I have > finished the calls and absolutely no memory was freed meaning that having > those 900 concurrent calls or none is taking up same amount of memory... how > can this be? It looks like the function receiving the UDP datagrams (tport_recv_dgram()) is fragmenting the memory. The idea there is to allocate 64K, do receive and then realloc() down to actually received amount of bytes. This avoids many pitfalls with socket implementations, except it seems to lead to horrible memory fragmentation. Try reduce the buffer size given to tport_recv_iovec() in tport_recv_dgram(), from 64K to, say, 2K, and see if there is any difference on you computer? Which architecture/operating system/C-library you are using? > Perhaps also giving some detailed information on how memory is managed when > receiving an invite, etc., could help me out figuring what to do... Quick overview (INVITE on UDP): 1) alloc msg_t+sip_t, alloc 64K, recv data, realloc down to size of received data 2) alloc header structures while parsin message 3) alloc server transaction (nta_incoming_t) 4) alloc nua_handle_t. and associated memory 5) alloc nua events, free them immediately after use 6) alloc response message(s), send them 7) free nua_handle_t and associated memory 8) free both request and response by timer 5 secs after ACK is received. BYE on UDP is similar (for steps 1..3, 5 and 7). BYE is freed 32 secs after it has been received. -- Pekka.Pessi mail at nokia.com _______________________________________________ Sofia-sip-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel
