Re: [go-nuts] Forced GC every 4 minutes

2024-11-01 Thread Ian Lance Taylor
On Fri, Nov 1, 2024 at 9:15 PM Siyuan Liu wrote: > > There is this strange behavior on a Golang service we are running. > > On some instances, there is a forced GC that gets triggered every 4 minutes. > This can be observed when the `GODEBUG=gctrace=1` is turned on. There is a > log line with `g

[go-nuts] Forced GC every 4 minutes

2024-11-01 Thread Siyuan Liu
There is this strange behavior on a Golang service we are running. On some instances, there is a forced GC that gets triggered every 4 minutes. This can be observed when the `GODEBUG=gctrace=1` is turned on. There is a log line with `gc ... (forced)` every 4 minutes consistently on selected ins

Re: [go-nuts] Returning a pointer or value struct.

2024-11-01 Thread Sharon Mafgaoker
I hope this will help us to better understand https://medium.com/eureka-engineering/understanding-allocations-in-go-stack-heap-memory-9a2631b5035d Sharon Mafgaoker – Senior Solutions Architect M. 050 995 99 16 | sha...@cloud5.co.il On Fri, 1 Nov 2024 at 19:21 Tushar Rawat wrote: > Hi Jason

Re: [go-nuts] Returning a pointer or value struct.

2024-11-01 Thread Jason E. Aten
Hi Tushar, I think you are getting the tradeoffs and building intuition well. p.s. Nits, if we want to be super pedantic (keeping in mind Ian's note that there really are no hard and fast rules)... 1) you probably meant 3 words instead of 3 bytes (3 words at 8 bytes per word is 24 bytes; an 8x

Re: [go-nuts] /usr/local/go/pkg/tool/linux_arm/link: running gcc failed: exit status 1

2024-11-01 Thread Ian Lance Taylor
On Fri, Nov 1, 2024 at 11:08 AM Stephan Lukits wrote: > > from my research I found it could be helpful to exectue gcc with the > `--mfloat-abi=hard` option; but I couldn't figure how to inject that option? I don't know whether it will fix your problem, but you can set the environment variable CG

[go-nuts] /usr/local/go/pkg/tool/linux_arm/link: running gcc failed: exit status 1

2024-11-01 Thread Stephan Lukits
from my research I found it could be helpful to exectue gcc with the `--mfloat-abi=hard` option; but I couldn't figure how to inject that option? ``` ~/go/src/hellogio $ go build . # example.con/rpi3/hellogio /usr/local/go/pkg/tool/linux_arm/link: running gcc failed: exit status 1 /usr/bin/gcc -m

Re: [go-nuts] Returning a pointer or value struct.

2024-11-01 Thread Tushar Rawat
Hi Jason, Make sense. So ideally even for the types/struct which are *more than 3 bytes* and *immutable, *if we are able to prove (with some profiling/perf. test) that their is actually a significant performance improvement on replacing value with pointer returns (because pointer copy is ch

Re: [go-nuts] Returning a pointer or value struct.

2024-11-01 Thread Jason E. Aten
Hi Tushar, My rule of thumb in practice is: for returning structs, I almost always return a pointer. The exception is -- the only time I would return a value in general -- is when: a) the returned value is _intended_ to be an immutable value, like a time.Time and a string value; *and* b) t