Hello All,
There is a structure sip_msg which is passed into a module and represents a received sip message. It contains number of pointers to hdr_field members. In its turn hdr_field contains member void* parsed
In the sanity module we assign to parsed member a pointer to newly allocated memory and we don't free that memory at the end. Do we need to free explicitly or this memory will be deallocated later together with sip_msg ?
In other words is it memory leak or not?
Best regards, Konstantin
Hello,
is this a new header or assigning to an existing header structure?
The existing headers are cleaned up inside clean_hdr_field().
Cheers, Daniel
On 31.05.18 11:54, Konstantin Polyakov wrote:
Hello All,
There is a structure *sip_msg* which is passed into a module and represents a received sip message. It contains number of pointers to *hdr_field* members. In its turn *hdr_field* contains member *void* parsed*
In the sanity module we assign to *parsed* member a pointer to newly allocated memory and we don't free that memory at the end. Do we need to free explicitly or this memory will be deallocated later together with *sip_msg*?
In other words is it memory leak or not?
Best regards, Konstantin
Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Hi Daniel,
Thank you for answer. We have pkg memory leak in 4.4.7 and I found that place in the sanity module during check of From header. That sip_msg comes from outside and we assign value to parsed member. So I expect it should be correct.
Best regards Konstantin
Пятница, 1 июня 2018, 13:31 +03:00 от Daniel-Constantin Mierla miconda@gmail.com:
Hello,
is this a new header or assigning to an existing header structure?
The existing headers are cleaned up inside clean_hdr_field().
Cheers, Daniel
On 31.05.18 11:54, Konstantin Polyakov wrote:
Hello All,
There is a structure sip_msg which is passed into a module and represents a received sip message. It contains number of pointers to hdr_field members. In its turn hdr_field contains member void* parsed
In the sanity module we assign to parsed member a pointer to newly allocated memory and we don't free that memory at the end. Do we need to free explicitly or this memory will be deallocated later together with sip_msg ?
In other words is it memory leak or not?
Best regards, Konstantin
Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference -- www.kamailioworld.com
С уважением, Константин Поляков.
Hello,
did you change the C code of sanity module?
The parsed field for From header should be populated by corresponding functions from core parser, if you overwrite it, then you leak what was there before. From header is among the ones parsed first, so likely it is already parsed as it gets to sanity module.
Cheers, Daniel
On 01.06.18 14:07, Konstantin Polyakov wrote:
Hi Daniel,
Thank you for answer. We have pkg memory leak in 4.4.7 and I found that place in the sanity module during check of From header. That sip_msg comes from outside and we assign value to parsed member. So I expect it should be correct.
Best regards Konstantin
Пятница, 1 июня 2018, 13:31 +03:00 от Daniel-Constantin Mierla <miconda@gmail.com>: Hello, is this a new header or assigning to an existing header structure? The existing headers are cleaned up inside clean_hdr_field(). Cheers, Daniel On 31.05.18 11:54, Konstantin Polyakov wrote:
Hello All, There is a structure *sip_msg* which is passed into a module and represents a received sip message. It contains number of pointers to *hdr_field* members. In its turn *hdr_field* contains member *void* parsed* In the sanity module we assign to *parsed* member a pointer to newly allocated memory and we don't free that memory at the end. Do we need to free explicitly or this memory will be deallocated later together with *sip_msg*? In other words is it memory leak or not? Best regards, Konstantin _______________________________________________ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference -- www.kamailioworld.com
С уважением, Константин Поляков.
Daniel,
Could you please recommend a way how to analyse pkg memory leak? Unfortunately I could not reproduce it in the lab. So we can see that only on a production server.
I use "kamcmd pkg.stats" command and see that memory usage is grown continuously. When I used "kamcmd mod.stats all pkg" command, result was not matched to previous command. How should I interpret the output of mod.stats all pkg command?
For example pkg.stats shows that each worker process uses 2428736 bytes memory { entry: 1 pid: 18598 rank: 1 used: 1269176 free: 5959872 real_used: 2428736 total_size: 8388608 total_frags: 67 } But total sum of memory usage according mod.stats is 534080.
Пятница, 1 июня 2018, 13:31 +03:00 от Daniel-Constantin Mierla miconda@gmail.com:
Hello,
is this a new header or assigning to an existing header structure?
The existing headers are cleaned up inside clean_hdr_field().
Cheers, Daniel
On 31.05.18 11:54, Konstantin Polyakov wrote:
Hello All,
There is a structure sip_msg which is passed into a module and represents a received sip message. It contains number of pointers to hdr_field members. In its turn hdr_field contains member void* parsed
In the sanity module we assign to parsed member a pointer to newly allocated memory and we don't free that memory at the end. Do we need to free explicitly or this memory will be deallocated later together with sip_msg ?
In other words is it memory leak or not?
Best regards, Konstantin
Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference -- www.kamailioworld.com
С уважением, Константин Поляков.