when a big SWAP file is used
but it is better to have more than needed.
I think I have a suspicion as to the cause.
Can you try running the following program on your router, and post the results?
Thanks
# ./test-swap
unit_size: 1 - total swap: 1073737728
Ok, as I suspected. I need to multiply those values - it was the first time I saw mem_unit have a value different from 1.
Many thanks!Ok, as I suspected. I need to multiply those values - it was the first time I saw mem_unit have a value different from 1.
# free
total used free shared buffers cached
Mem: 934032 903232 30800 2328 560 554236
-/+ buffers/cache: 348436 585596
Swap: 5242876 0 5242876
# cat /proc/meminfo | grep -i swap
SwapCached: 0 kB
SwapTotal: 5242876 kB
SwapFree: 5242876 kB
# /mnt/ClickUSB1/ASUS/test-swap
unit_size: 4096 - total swap: 1310719
It's not that simple, as I don't store it anywhere, it's directly manipulated as a float, and sent as text to the web page:Looks like the total size is being stored in a 32 bit variable and is overflowing.
sprintf(result,"%.2f",(sys.totalswap * sys.mem_unit / (float)MBYTES));
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!