Top is not reporting the accurate memory usage of your application.

There are several ways to introspect your Go application to find its real 
memory usage, but the easiest way is to set GODEBUG=gctrace=1 and wait for 
lines that start with scvg: to be printed, they will tell you the current 
memory usage.

The format of the scvg: line is documented here https://godoc.org/runtime

On Wednesday, 22 March 2017 19:13:44 UTC+11, tpoisonooo wrote:
>
> I have nearly implemented a face recognition server on my nvdia tx1. 
>
> It loads all face data from MYSQL, listen port,  receive picture and 
> return the nearest face's name.
>
> I use `top` to show how many memory this program used, like this;
>
> >top - 07:46:03 up 2 days,  5:55,  3 users,  load average: 0.16, 0.25, 0.24
> Tasks: 219 total,   1 running, 218 sleeping,   0 stopped,   0 zombie
> %Cpu(s):  0.6 us,  2.6 sy,  0.0 ni, 96.7 id,  0.0 wa,  0.0 hi,  0.1 si, 
>  0.0 st
> KiB Mem :  4092340 total,    19692 free,  3282888 used,   789760 buff/cache
> KiB Swap:        0 total,        0 free,        0 used.   631872 avail Mem
>
>  PID      USER      PR    NI    VIRT              RES       SHR   S     
> %CPU   %MEM     TIME+    COMMAND          
> 11455   ubuntu     20     0      1289156       716612   16284 S      0.0   
>      17.5         0:09.96    sofacer.com
>
>
> This server cost 17.5% memory, but the size of all face data is 222MB.
> I tried `runtime.GC()` and `pprof.WriteHeapProfile()`:
>
> >ubuntu@tegra-ubuntu:~/GoProjects/src/sofacer.com$ go tool pprof 
> mem.profile
> Entering interactive mode (type "help" for commands)
> (pprof) top
> 158.68MB of 158.68MB total (  100%)
>       flat  flat%   sum%        cum   cum%
>   158.68MB   100%   100%   158.68MB   100%
> (pprof)
>
>
> In low-memory state, tx1 would kill my go server.
> How to decrese memory usage in `top` ?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to