Go Memory Consumption

My go project hung after some time . Is it the issue of memory consumption ? If yes, Can it be resolved by garbage collector?

I’ m not an Go expert but maybe you have your source code on GitHub or share the code with Go Playground just past the code in click on share and post the link here.

Out of the blue its hard to tell whats the problem.
Some links about profiling Go programs:

Introducing profile, super simple profiling for Go programs link to the tool:
https://github.com/pkg/profile

The Go Blog Profiling Go Programs
stack overflow - how to analyse golang memory
Intel Developer Zone - Debugging performance issues in Go programs

Thanks for your quick response.
I can’t share you the code or website link because of the copyright issue , but in general, I want to know the guidelines and ways to optimize the golang app. So that we can speed up the web app .Can you also tell me the usual reason of hanging the go app because when we run the app for 20-30 minutes then it hung and sometimes it crashed the web browser.
Thanks in advance

the programmers don’t suppose. try to debug your program, or use some logs. nobody can know what happen in your program without any clues. does not exist an usual reason of hanging. :wink:

For optimising speed, or seeing where you are spending time, I find go torch invaluable:

If you run it locally you should be able to insert logging as George says above for any action which you suspect might cause a problem, plus you can output memory usage from the runtime package periodically. If your app actually crashes (panics), you should see a stack trace which you can use to find the problem, if it just hangs, perhaps it is using up too much memory and eventually going into swap. Another more primitive approach is simply to remove bits of the program one at a time till it does not crash. Without seeing source it’s unlikely someone here can help you.

2 Likes

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