<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><tt>Hi, Rodrigo!</tt></p>
    <p><tt><br>
      </tt></p>
    <p><tt>Valgrind may report some memory allocated, and not freed, but
        that is not necessarily a memory leak. There is a single block
        of 1024 bytes not freed during runtime, so I think that is
        peanuts. The memory used by OpenSIPS is not allocated with
        malloc, so cannot be traced by valgrind.<br>
      </tt></p>
    <p><tt>Regarding the system memory, it is normal to decrease as
        OpenSIPS uses that memory during runtime. However, after some
        time, this should </tt><tt>
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        stabilize. Anyhow, sometimes the system memory might generate
        false alarms, so if you are tracing any memory leaks, you should
        check OpenSIPS's internal statistics.</tt></p>
    <p><tt><br>
      </tt></p>
    <p><tt>Best regards,<br>
      </tt></p>
    <pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 06/21/2016 10:38 PM, Rodrigo Pimenta
      Carvalho wrote:<br>
    </div>
    <blockquote
cite="mid:BY2PR02MB165503FDBEC0D49EDD4AACDBB52B0@BY2PR02MB1655.namprd02.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
        <p>Hi.</p>
        <p><br>
        </p>
        <p>Does someone here is getting/handling memory leaks with
          OpenSIPS 2.2 and last version of SQLite?</p>
        <p>I'm using newest commit from OpenSIPS 2.2 and newest version
          of SQLite.</p>
        <p><br>
        </p>
        <p>My query is : <br>
        </p>
        <p><br>
        </p>
        <p><span style="color: rgb(0, 111, 201);" lang="EN-US">avp_db_query("select
            Value from GeneralConfigurations where Attribute =
            'CONFIGURATION_INTERCOM_A_NAME'");</span></p>
        <p><span lang="EN-US"><br>
          </span></p>
        <p><span lang="EN-US">Valgrind shows:</span></p>
        <p><span lang="EN-US"><br>
          </span></p>
        <p><span lang="EN-US"></span></p>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16087==
            ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from
            2)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==
            Searching for pointers to 296,489 not-freed blocks</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==
            Checked 103,297,688 bytes</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==
          </span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==
            1,024 bytes in 1 blocks are possibly lost in loss record 184
            of 246</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            at 0x4C2745D: malloc (in
            /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x8F8B05F: sqlite3MemMalloc (sqlite3.c:20167)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x8F701C7: sqlite3Malloc (sqlite3.c:23846)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x8F75459: pcache1Alloc (sqlite3.c:44312)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x8F8019F: sqlite3BtreeCursor (sqlite3.c:44455)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x8FD0FDD: sqlite3VdbeExec (sqlite3.c:80098)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x8FDB89F: sqlite3_step (sqlite3.c:75131)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x8FDC9A1: sqlite3_exec (sqlite3.c:108122)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x8D20736: db_sqlite_raw_query (dbase.c:358)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x9464DB8: db_query_avp (avpops_db.c:436)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x946943E: ops_dbquery_avps (avpops_impl.c:840)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            by 0x9459A61: w_dbquery_avps (avpops.c:1395)</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==
          </span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==
            LEAK SUMMARY:</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            definitely lost: 0 bytes in 0 blocks</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            indirectly lost: 0 bytes in 0 blocks</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==     
            <span style="color: rgb(255, 0, 0);">
              possibly lost: 1,024 bytes in 1 blocks</span></span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==   
            still reachable: 47,457,573 bytes in 296,488 blocks</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==        
            suppressed: 0 bytes in 0 blocks</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==
            Reachable blocks (those to which a pointer was found) are
            not shown.</span></p>
        <span style="color: rgb(0, 111, 201);"></span>
        <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
          font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">
          <span style="color: rgb(0, 111, 201);" lang="EN-US">==16088==
            To see them, rerun with: --leak-check=full
            --show-leak-kinds=all</span></p>
        <br>
        <p><span lang="EN-US"></span><br>
        </p>
        <p>After some time running that query, I can see, via command
          top, that the available memory is decreasing.</p>
        <p>In fact, the memory is not freed even after stop running the
          query for a time.</p>
        <p><br>
        </p>
        <p>Best regards.<br>
        </p>
        <p><br>
        </p>
        <div id="Signature">
          <div name="divtagdefaultwrapper"
            style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:; margin:0">
            <div class="BodyFragment"><font size="2">
                <div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
                  Inatel Competence Center<br>
                  Software<br>
                  Ph: +55 35 3471 9200 RAMAL 979<br>
                </div>
              </font></div>
          </div>
        </div>
        <span lang="EN-US"></span>
        <div style="color: rgb(0, 0, 0);">
          <div>
            <div style="">
              <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
                font-family:
                &quot;Calibri&quot;,&quot;sans-serif&quot;;">
                <span lang="EN-US"> </span></p>
              <br>
              <p style="margin: 0cm 0cm 0.0001pt; font-size: 11pt;
                font-family:
                &quot;Calibri&quot;,&quot;sans-serif&quot;;">
                <span lang="EN-US"> </span><br>
              </p>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>