<p>it's running on AWS EC2's Amazon Linux (which is based on Enterprise Red Hat Linux).</p>
<p>the output of <code>kamailio -I</code> is:</p>
<pre><code>Print out of kamailio internals
  Version: kamailio 4.4.2 (x86_64/linux) 892ad6
  Default config: /xxxxxx/xxx/xxx/etc/kamailio/kamailio.cfg
  Default paths to modules: /xxxxxx/xxx/xxx/lib64/kamailio/modules
  Compile flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
  MAX_RECV_BUFFER_SIZE=262144
  MAX_LISTEN=16
  MAX_URI_SIZE=1024
  BUF_SIZE=65535
  DEFAULT PKG_SIZE=8MB
  DEFAULT SHM_SIZE=64MB
  ADAPTIVE_WAIT_LOOPS=1024
  TCP poll methods: poll, epoll_lt, epoll_et, sigio_rt, select
  Source code revision ID: 892ad6
  Compiled with: x86_64-unknown-linux-gnu-gcc 4.9.4
  Compiled on: 16:57:00 Jun  5 2018
Thank you for flying kamailio!
</code></pre>
<p>just to confirm if gdb is not messing up something, I calculated the memory used inside the C file:</p>
<pre><code> int vin_block = sizeof(cfg_block_t);
        int vin_atom = sizeof(atomic_t);
        unsigned char v_vars[1];
        int vin_vars = sizeof(v_vars);

--- GDB output ---

(gdb) print vin_block
$1 = 8
(gdb) print vin_atom
$2 = 4
(gdb) print vin_vars
$3 = 1
</code></pre>
<p>This should be fine as gcc usually does padding as discussed here:<br>
<a href="https://stackoverflow.com/questions/1841863/size-of-struct-in-c" rel="nofollow">https://stackoverflow.com/questions/1841863/size-of-struct-in-c</a></p>
<p>So even if the sum of components is 5, it pads it to 8 (unless you have padding disabled in gcc).<br>
For, your case, where it's 9 ... it should actually be 12 if padding is enabled (this is enabled by default in gcc for many linux distros).</p>
<p>I'm not sure how the actual config variable mapping is done but it seems like the way it's being mapped, our variable ends up at the final 3 byte block (although the size is 4 bytes); which also means that there might be gaps in the middle of the memory block. However, this is just speculation.</p>
<p>let me know if you need any further info.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1583#issuecomment-402820932">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36Zaq4MA8UDwcVRKpgecljj-90a8vBks5uDmH-gaJpZM4VDDlj">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZUi-P3L_omDD9sTBfAh64KSNGRVEks5uDmH-gaJpZM4VDDlj.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@vinesinha in #1583: it's running on AWS EC2's Amazon Linux (which is based on Enterprise Red Hat Linux).\r\n\r\nthe output of `kamailio -I` is:\r\n\r\n```\r\nPrint out of kamailio internals\r\n  Version: kamailio 4.4.2 (x86_64/linux) 892ad6\r\n  Default config: /xxxxxx/xxx/xxx/etc/kamailio/kamailio.cfg\r\n  Default paths to modules: /xxxxxx/xxx/xxx/lib64/kamailio/modules\r\n  Compile flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES\r\n  MAX_RECV_BUFFER_SIZE=262144\r\n  MAX_LISTEN=16\r\n  MAX_URI_SIZE=1024\r\n  BUF_SIZE=65535\r\n  DEFAULT PKG_SIZE=8MB\r\n  DEFAULT SHM_SIZE=64MB\r\n  ADAPTIVE_WAIT_LOOPS=1024\r\n  TCP poll methods: poll, epoll_lt, epoll_et, sigio_rt, select\r\n  Source code revision ID: 892ad6\r\n  Compiled with: x86_64-unknown-linux-gnu-gcc 4.9.4\r\n  Compiled on: 16:57:00 Jun  5 2018\r\nThank you for flying kamailio!\r\n```\r\n\r\njust to confirm if gdb is not messing up something, I calculated the memory used inside the C file:\r\n\r\n```\r\n\tint vin_block = sizeof(cfg_block_t);\r\n\tint vin_atom = sizeof(atomic_t);\r\n\tunsigned char v_vars[1];\r\n\tint vin_vars = sizeof(v_vars);\r\n\r\n--- GDB output ---\r\n\r\n(gdb) print vin_block\r\n$1 = 8\r\n(gdb) print vin_atom\r\n$2 = 4\r\n(gdb) print vin_vars\r\n$3 = 1\r\n```\r\n\r\nThis should be fine as gcc usually does padding as discussed here:\r\nhttps://stackoverflow.com/questions/1841863/size-of-struct-in-c\r\n\r\nSo even if the sum of components is 5, it pads it to 8 (unless you have padding disabled in gcc). \r\nFor, your case, where it's 9 ... it should actually be 12 if padding is enabled (this is enabled by default in gcc for many linux distros).\r\n\r\nI'm not sure how the actual config variable mapping is done but it seems like the way it's being mapped, our variable ends up at the final 3 byte block (although the size is 4 bytes); which also means that there might be gaps in the middle of the memory block. However, this is just speculation. \r\n\r\nlet me know if you need any further info. \r\n\r\n\r\n"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1583#issuecomment-402820932"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1583#issuecomment-402820932",
"url": "https://github.com/kamailio/kamailio/issues/1583#issuecomment-402820932",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "Re: [kamailio/kamailio] cfg_rpc updates changing variable values to large random numbers  (#1583)",
"sections": [
{
"text": "",
"activityTitle": "**vinesinha**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@vinesinha",
"facts": [

]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1583,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1583\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/kamailio/kamailio/issues/1583#issuecomment-402820932"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 353122659\n}"
}
],
"themeColor": "26292E"
}
]</script>