Too much memory usage. Appreccite any help [SOLVED]

GODEBUG using this sintax, should be an excutable… Where is this executable? I mean, if I run;

>> GODBUG=gctrace=1 c:\myapp\myapp.exe

GODEBUG is the program. So where is it? If I don’t need installing GO on prodution machine…

[EDITED]
I’m sorry but I still don’t understand how this GODEBUG works, and there’s no consistent information about it on the web…

Environment variables work a little differently in windows, so you’ll need to run this as 2 commands:

> set GODEBUG=gctrace=1
> c:\myapp\myapp.exe

Aaaaaah!! Now I get it… One more doubt; do I have to change my code, I mean put something like breakpoints? I saw on Google some tutorials in which the guy included a

_ = "breakpoint"

Please refer to the section Environment Variables

https://golang.org/pkg/runtime/

You don’t need to change anything. I don’t know where you read that information but it is likely incorrect or not relevant to the advice provided.

Just did it right now, but I see nothing…

Then you probably didn’t do it correctly, the output will be immediate and continual.

I did exactly how @ctd1500 showed… The way he put there’s nno way how to mistake.

Now it’s showing, guess it delays about 2 minutes…

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Administrator>cd c:\hlsat

c:\HLsat>GODEBUG=gctrace=1 ./teste.exe
'GODEBUG' is not recognized as an internal or external command,
operable program or batch file.

c:\HLsat>GODEBUG=gctrace=1 c:\hlsat\teste.exe
'GODEBUG' is not recognized as an internal or external command,
operable program or batch file.

c:\HLsat>set GODEBUG=gctrace=1

c:\HLsat>.\teste.exe
scvg0: inuse: 0, idle: 0, sys: 1, released: 0, consumed: 1 (MB)
scvg1: inuse: 1, idle: 0, sys: 2, released: 0, consumed: 2 (MB)
scvg2: inuse: 2, idle: 0, sys: 3, released: 0, consumed: 3 (MB)
scvg3: inuse: 2, idle: 0, sys: 3, released: 0, consumed: 3 (MB)
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Administrator>cd c:\hlsat

c:\HLsat>GODEBUG=gctrace=1 ./teste.exe
'GODEBUG' is not recognized as an internal or external command,
operable program or batch file.

c:\HLsat>GODEBUG=gctrace=1 c:\hlsat\teste.exe
'GODEBUG' is not recognized as an internal or external command,
operable program or batch file.

c:\HLsat>set GODEBUG=gctrace=1

c:\HLsat>.\teste.exe
scvg0: inuse: 0, idle: 0, sys: 1, released: 0, consumed: 1 (MB)
scvg1: inuse: 1, idle: 0, sys: 2, released: 0, consumed: 2 (MB)
scvg2: inuse: 2, idle: 0, sys: 3, released: 0, consumed: 3 (MB)
scvg3: inuse: 2, idle: 0, sys: 3, released: 0, consumed: 3 (MB)
scvg4: inuse: 3, idle: 0, sys: 4, released: 0, consumed: 4 (MB)
scvg5: inuse: 3, idle: 0, sys: 4, released: 0, consumed: 4 (MB)
scvg6: 0 MB released
scvg6: inuse: 3, idle: 0, sys: 4, released: 0, consumed: 4 (MB)

c:\HLsat>set GODEBUG=gctrace=1

c:\HLsat>.\teste.exe
scvg0: inuse: 0, idle: 0, sys: 1, released: 0, consumed: 1 (MB)
scvg1: inuse: 1, idle: 0, sys: 2, released: 0, consumed: 2 (MB)
scvg2: inuse: 2, idle: 0, sys: 3, released: 0, consumed: 3 (MB)
scvg3: inuse: 2, idle: 0, sys: 3, released: 0, consumed: 3 (MB)
scvg4: inuse: 3, idle: 0, sys: 4, released: 0, consumed: 4 (MB)
scvg5: inuse: 3, idle: 0, sys: 4, released: 0, consumed: 4 (MB)
scvg6: 0 MB released
scvg6: inuse: 3, idle: 0, sys: 4, released: 0, consumed: 4 (MB)
gc 1 @1139.340s 0%: 0.97+0+0.97 ms clock, 1.9+0/0/0+1.9 ms cpu, 4->4->0 MB, 5 MB
 goal, 2 P
scvg7: inuse: 1, idle: 3, sys: 5, released: 0, consumed: 5 (MB)
GC forced
gc 2 @1261.860s 0%: 0+22+3.9 ms clock, 0+0/22/0+7.8 ms cpu, 0->0->0 MB, 4 MB goa
l, 2 P
scvg8: inuse: 0, idle: 4, sys: 5, released: 0, consumed: 5 (MB)
GC forced
gc 3 @1394.333s 0%: 0+0.97+0.97 ms clock, 0+0/0.97/0.97+1.9 ms cpu, 0->0->0 MB,
4 MB goal, 2 P

Your program is using less than 4mb of memory according to the GODEBUG data.

Now it’s releasing memory, but earlier, my program was getting 100mb… This program as a Windows Service on Delphi uses 400kb ram whole time…

What does Idle and Sys mean?

What does Idle and Sys mean?

c:\HLsat>set GODEBUG=gctrace=1

c:\HLsat>.\teste.exe
scvg0: inuse: 0, idle: 0, sys: 1, released: 0, consumed: 1 (MB)
scvg1: inuse: 1, idle: 0, sys: 2, released: 0, consumed: 2 (MB)
scvg2: inuse: 2, idle: 0, sys: 3, released: 0, consumed: 3 (MB)
scvg3: inuse: 2, idle: 0, sys: 3, released: 0, consumed: 3 (MB)
scvg4: inuse: 3, idle: 0, sys: 4, released: 0, consumed: 4 (MB)
scvg5: inuse: 3, idle: 0, sys: 4, released: 0, consumed: 4 (MB)
scvg6: 0 MB released
scvg6: inuse: 3, idle: 0, sys: 4, released: 0, consumed: 4 (MB)
gc 1 @1139.340s 0%: 0.97+0+0.97 ms clock, 1.9+0/0/0+1.9 ms cpu, 4->4->0 MB, 5 MB
 goal, 2 P
scvg7: inuse: 1, idle: 3, sys: 5, released: 0, consumed: 5 (MB)
GC forced
gc 2 @1261.860s 0%: 0+22+3.9 ms clock, 0+0/22/0+7.8 ms cpu, 0->0->0 MB, 4 MB goa
l, 2 P
scvg8: inuse: 0, idle: 4, sys: 5, released: 0, consumed: 5 (MB)
GC forced
gc 3 @1394.333s 0%: 0+0.97+0.97 ms clock, 0+0/0.97/0.97+1.9 ms cpu, 0->0->0 MB,
4 MB goal, 2 P
GC forced
gc 4 @1514.756s 0%: 0+31+0.97 ms clock, 0+0.97/21/13+1.9 ms cpu, 0->0->0 MB, 4 M
B goal, 2 P
scvg9: 1 MB released
scvg9: inuse: 0, idle: 4, sys: 5, released: 1, consumed: 3 (MB)
GC forced
gc 5 @1634.817s 0%: 0+10+0.97 ms clock, 0+1.9/10/0+1.9 ms cpu, 0->0->0 MB, 4 MB
goal, 2 P
scvg10: 1 MB released
scvg10: inuse: 0, idle: 4, sys: 5, released: 3, consumed: 1 (MB)
GC forced
gc 6 @1755.917s 0%: 0+6.8+1.9 ms clock, 0+0/6.8/0+3.9 ms cpu, 0->0->0 MB, 4 MB g
oal, 2 P
scvg11: 0 MB released
scvg11: inuse: 0, idle: 4, sys: 5, released: 3, consumed: 1 (MB)
GC forced
gc 7 @1886.179s 0%: 0+1.9+0.97 ms clock, 0+1.9/1.9/0+1.9 ms cpu, 0->0->0 MB, 4 M
B goal, 2 P
scvg12: inuse: 0, idle: 4, sys: 5, released: 3, consumed: 1 (MB)
GC forced
gc 8 @2009.239s 0%: 0+0+1.9 ms clock, 0+0/0/0+3.9 ms cpu, 0->0->0 MB, 4 MB goal,
 2 P
GC forced
gc 9 @2129.300s 0%: 0+0.97+0.97 ms clock, 0+0.97/0/0.97+1.9 ms cpu, 0->0->0 MB,
4 MB goal, 2 P
scvg13: inuse: 0, idle: 4, sys: 5, released: 3, consumed: 1 (MB)
GC forced
gc 10 @2249.767s 0%: 0+4.8+0 ms clock, 0+0/4.8/0+0 ms cpu, 0->0->0 MB, 4 MB goal
, 2 P
scvg14: 0 MB released
scvg14: inuse: 0, idle: 4, sys: 5, released: 4, consumed: 0 (MB)
GC forced
gc 11 @2384.299s 0%: 0+0+0 ms clock, 0+0/0/0+0 ms cpu, 0->0->0 MB, 4 MB goal, 2
P

Inuse: memory packages that are at least partially full of data
Idle: memory packages that had no data on them
Sys: memory packages requested from the operating system
Released: memory packages that we’ve told the operating system that are not needed. As I understand this is not implemented on windows.

Idle plus released plus inuse should be equal to sys.

All values are in operating system pages which are normally 4kb

1 Like

These are documented on the link I provided above.

Leonardo,

Take a look on this presentation about go profile from GopherCon Brasil 2016.

The talk (in portuguese) is from Cezar Sá (globo.com)
The content is very good, but the screen recording is not. But you can find the examples on

https://github.com/gopherconbr/talks/tree/master/benchmarks-profiling

Danilo.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.