### Description
ul.dump can't work with huge amount of aor (~40K), it fail with 500, "Internal error creating aor struct". And seems it get and not free'd memory, after some calls kamcmd ul.dump / kamcmd ul.dump brief kamailio stop service with messages:
``` Apr 28 13:36:11 kamailio-c2 kamailio2[49808]: ERROR: <core> [sip_msg_clone.c:498]: sip_msg_shm_clone(): cannot allocate memory Apr 28 13:36:11 kamailio-c2 kamailio2[49808]: ERROR: dmq [worker.c:164]: add_dmq_job(): error cloning sip message Apr 28 13:36:11 kamailio-c2 kamailio2[49808]: ERROR: dmq [message.c:67]: dmq_handle_message(): failed to add dmq job Apr 28 13:36:11 kamailio-c2 kamailio2[49808]: ERROR: <core> [mem/q_malloc.c:292]: qm_find_free(): qm_find_free(0x809132000, 3976); Free fragment not found! Apr 28 13:36:11 kamailio-c2 kamailio2[49808]: ERROR: <core> [mem/q_malloc.c:425]: qm_malloc(): qm_malloc(0x809132000, 3976) called from core: sip_msg_clone.c: sip_msg_shm_clone(495), module: core; Free fragment not found! ```
### Possible Solutions
Need rewrite ul_rpc_dump() in modules/usrloc/ul_rpc.c to aor-by-aor print.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 5.0.0-dev6 (x86_64/freebsd) 9fe51e-dirty 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, FAST_LOCK-ADAPTIVE_WAIT, USE_POSIX_SEM, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, select, kqueue. id: 9fe51e -dirty compiled on 10:49:57 Nov 18 2016 with cc 3.4
```
* **Operating System**:
``` FreeBSD kamailio-c2 10.3-STABLE FreeBSD 10.3-STABLE #0 r306194 ```
Closed #1513.
The error messages refer to shared memory, but kamcmd commands are handled by ctl module which uses private memory. For large results of kamcmd commands, look at the readme of ctl module, there are some module parameters that you have to set.
You can also provide the AoR as parameter to ul.dump command and you get only the details for that subscriber.
For shared memory errors, be sure you give enough memory to kamailio via `-m` command line parameter.
Overall, this doesn't look like a bug, but more like config options limitations, so I am closing it. If you want to discuss more about, use sr-users mailing list and if it proves there is a bug, an issue can be opened with the relevant details.