<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p><br>
    </p>
    <p>ok, I see the limitation and should be fixed in a way or another,
      even for 5.0. But maybe is better to use the system memory in this
      case, the shared memory requires locking and I don't see it's
      necessary in this case. Actually same happens with the mysql (or
      other db backends), they fetch the result in system memory and
      then our modules convert what's needed to pkg memory. db text has
      the lib embedded and that part can use system malloc.</p>
    <p><br>
    </p>
    <p>My suggestion is to define some aliases to memory functions, like
      dbt_malloc/dbt_free/..., pointing them to malloc/free/... or
      pkg_malloc/pkg_free/... based on a compile time flag and set it to
      the system malloc via module Makefile. Same is done by ctl module,
      which can be used as example, see: src/modules/ctl/ctl.h .</p>
    <p><br>
    </p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 05/01/2017 18:19, Luis Azedo wrote:<br>
    </div>
    <blockquote cite="mid:1483636785079.66167@2600hz.com" type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
      <p>Hi All,<br>
      </p>
      <p><br>
      </p>
      <p>db_text modules manages the tables data in shm_mem<br>
      </p>
      <p>db_text module uses pkg_mem to store query results which leads
        to some problems.<br>
      </p>
      <p><br>
      </p>
      <p>when we have large text files with a lot of rows (location,
        active_watchers, presentity), the startup procedure fetches all
        the records, which makes db_text copy all records from shm_mem
        to pkg_mem, leading to memory failures.<br>
      </p>
      <p><br>
      </p>
      <p>i now have a patch that changes this behaviour.<br>
      </p>
      <p>it creates temp tables in shm_mem with the results<br>
      </p>
      <p>if implements fetch_result so that startup procedures that
        fetch all rows can safely run without memory issues.<br>
      </p>
      <p><br>
      </p>
      <p>if anyone has anything against, please reply.<br>
      </p>
      <p>i would like to get this merged before 5.0<br>
      </p>
      <p><br>
      </p>
      <p>Thanks<br>
      </p>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
sr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference - May 8-10, 2017 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>