#20790: luci status : wrong memory readings
-------------------------+---------------------------------------
  Reporter:  bolvan      |      Owner:
      Type:  defect      |     Status:  closed
  Priority:  low         |  Milestone:  Designated Driver (Trunk)
 Component:  luci        |    Version:  Trunk
Resolution:  worksforme  |   Keywords:
-------------------------+---------------------------------------

Comment (by bolvan):

 OK, lets stop using luci and compile simple program.
 Purprose of this program is to reveal the largest possible block size
 malloc cat receive from the system.

 {{{
 #include <stdio.h>

 void main(int argc,char **argv)
 {
  if (argc>1)
  {
   int size = atoi(argv[1]);
   void *p = malloc(size*1024);
   free(p);
   printf(p ? "malloc ok\n" : "malloc fail\n");
  }
 }
 }}}

 Now run "ubus call" and "free"


 {{{
 k@wifi:~/tmp/testalloc$ sudo ubus call system info
 {
         "uptime": 78752,
         "localtime": 1445705328,
         "load": [
                 16448,
                 32864,
                 19200
         ],
         "memory": {
                 "total": 61890560,
                 "free": 1507328,
                 "shared": 724992,
                 "buffered": 765952
         },
         "swap": {
                 "total": 0,
                 "free": 0
         }
 }
 k@wifi:~/tmp/testalloc$ free
               total        used        free      shared  buff/cache
 available
 Mem:          60440       18492        1392         708       40556
 31324
 Swap:             0           0           0

 }}}

 And try some test allocs :

 {{{
 k@wifi:~/tmp/testalloc$ ./ta 31324
 malloc ok
 k@wifi:~/tmp/testalloc$ ./ta 31800
 malloc fail
 }}}

 This proves that available memory mount is something around 31M.
 Now compare to sysinfo results.

 Something wrong in the house ?
 Looks like ubus call return wrong buffered size.

--
Ticket URL: <https://dev.openwrt.org/ticket/20790#comment:4>
OpenWrt <http://openwrt.org>
Opensource Wireless Router Technology
_______________________________________________
openwrt-tickets mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-tickets

Reply via email to