Hi Brian,

A Go program can crash because of Out of Memory. Yes it can be because of
goroutine leak. Or it can have some reference to global variables, but it
should be freed? How to debug this?
When the leak is happening while using CGO, is there any tool to debug this?

Best Regards
Mariappan

On Thu, Jan 12, 2023 at 2:19 PM Brian Candler <b.cand...@pobox.com> wrote:

> I think you're not being clear on your problem you're trying to solve.
>
> There are no "memory leaks" in Go in the traditional sense (omitting to
> free an allocation) because of the garbage collector. Therefore, if memory
> is not being freed in a pure Go program, it's because you are keeping a
> reference to it somewhere - e.g. in a global variable, directly or
> indirectly. Or it could be referenced from a local variable in a goroutine
> which isn't terminating - in that case I'd say that's a goroutine leak, not
> a memory leak.  Is that the sort of thing you're trying to debug?
>
> Or, is the situation that you're using CGO and forgetting to free some
> allocations in your C code?
>
> Or, I've seen some people complain that Go doesn't not release unused
> memory back to the operating system as quickly as they'd like or expect,
> showing as high RSS. If that's your issue then it can be discussed.
>
> On Thursday, 12 January 2023 at 03:58:52 UTC mariappa...@gmail.com wrote:
>
>> Hello Go experts,
>>
>> Can someone please help with this?
>>
>> Best Regards
>> Mariappan
>>
>> On Tue, Jan 10, 2023 at 1:24 PM mariappan balraj <mariappa...@gmail.com>
>> wrote:
>>
>>> Hello Go experts,
>>>
>>> I could able to find the solution to debug memory leaks of GO process,
>>> when it is running by using PPROF. Is it possible to collect the heap
>>> profile for debugging, when GO process crashed using core dump? or what is
>>> the recommended way to root cause the memory leak? Based on the need,
>>> enabling PPROF and debugging may not be possible in the production
>>> environment. Please help.
>>>
>>> Best Regards
>>> Mariappan
>>>
>> --
> 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 golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/19a761a1-7707-4300-9128-93f22b9ee342n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/19a761a1-7707-4300-9128-93f22b9ee342n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAKKWi6SKZr9x7-YoJNLLp57815bzg40wjCsYSYxtd7SQ2VMEUA%40mail.gmail.com.

Reply via email to