It seems likely that the Pulsar Go client can use CGO for certain features, specifically for ZStd compression, which can improve performance by leveraging the native C library if CGO is enabled. This is controlled at build time—if your application is built with CGO enabled, the Go client will use the C version of ZStd, otherwise it defaults to the pure Go implementation. High resident memory usage (RSS) compared to Go heap may be due to allocations in C libraries (like ZStd) or memory fragmentation outside the Go heap, which Go's memory profiler does not track. See
this PR for details.
If you are seeing a large difference between Go heap and RSS, it could be related to native memory allocations from CGO or compression libraries, not just Go heap usage. Disabling compression or building without CGO may help isolate the cause. Would you like more detail on how to check or control CGO usage in your build, or on memory profiling techniques for native allocations?
Sources:
-
this PR for details 👍 0 button 👎 0 button 💡
Hint: Mention @runllm in the thread for followups.