[ 
https://issues.apache.org/jira/browse/TS-640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13744972#comment-13744972
 ] 

Yunkai Zhang commented on TS-640:
---------------------------------

Sorry, I use valgrind instead of eyes:) to test it again, there is no obvious 
memory leak.

At least, when remove "TS_MGMT_OPT_NO_SOCK_TESTS" option (traffic_cop need 
*socket_test_thread* to *reconnect* manager), there is no memory leak(after 
fixed a small bug in Terminate()):

==test code==
{code}
int
main(int argc, char *argv[])
{ 
  int nr_loop = 1000000;

  if (argc > 1)
    nr_loop = atoi(argv[1]);

  for (int i = 0; i < nr_loop; i++) {
    TSInit("/var/run/trafficserver", 
static_cast<TSInitOptionT>(TS_MGMT_OPT_NO_EVENTS));
    sleep(1);
    TSTerminate();
  }
}
{code}

==valgrind output===
{code}
....
==64760== LEAK SUMMARY:
==64760==    definitely lost: 0 bytes in 0 blocks
==64760==    indirectly lost: 0 bytes in 0 blocks
==64760==      possibly lost: 0 bytes in 0 blocks
==64760==    still reachable: 64 bytes in 2 blocks
==64760==         suppressed: 0 bytes in 0 blocks
==64760==
==64760== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
--64760--
--64760-- used_suppression:      6 dl-hack3-cond-1
==64760==
==64760== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
{code}

So I'll give a patch to remove "TS_MGMT_OPT_NO_SOCK_TESTS" in traffic_cop 
program and fix a small bug in Terminate().
                
> Repeated INKInit() / INKTerminate() will leak lots of memory
> ------------------------------------------------------------
>
>                 Key: TS-640
>                 URL: https://issues.apache.org/jira/browse/TS-640
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Management API
>            Reporter: Leif Hedstrom
>            Assignee: Leif Hedstrom
>             Fix For: 2.1.6
>
>
> If you do
> INKInit();
> INKTerminate()
> repeatedly, the process will leak memory something fiercely. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to