Re: [go-nuts] CGO Threads and Memory Not Being Released in Go

2025-03-08 Thread robert engels
I suspect your implementation is incorrect in some way, or you have a memory leak of another sort. When I used your original code, the memory usage according to the activity monitor was > 100 mb. When I changed it to use a semaphore to limit the concurrency to 64 threads, it was about 16mb. Y

Re: [go-nuts] CGO Threads and Memory Not Being Released in Go

2025-03-08 Thread David Bell
I wanted to add some clarification on my misunderstanding and the approaches I tried. I tested two different strategies to handle the CGO calls: 1. *Worker Pool Approach* (50 workers handling CGO calls) - I set up a worker pool with 50 goroutines, each making CGO calls in a

Re: [go-nuts] CGO Threads and Memory Not Being Released in Go

2025-03-08 Thread David Bell
Hi Ian and Robert, First, thank you both for taking the time to answer and provide insights! I really appreciate it. To clarify, my real program is a long-lived process that receives network traffic from C++ code and processes it in Go. The CGO calls in my program seemed to be the likely cul