Golang heapsize remains constant but the allocations are increasing

276 Views Asked by At

I have a go microservice for which the resident memory consumption is constantly increasing with number of requests.

I used pprof to determine whether i have any of following scenarios:

  • increasing goroutines (remains consistent and the number drops down as load is decreased)
  • heap size (heap size (inuse_space and inuse_objects)) remains consistent throughout the time

I went to the pprof interactive page http://localhost:6060/debug/pprof/ and saw that the allocs and heap are increasing.

Timestamp 1

Types of profiles available:
Count   Profile
46  allocs
0   block
0   cmdline
109 goroutine
46  heap
0   mutex
0   profile
15  threadcreate
0   trace

Timestamp 2

Types of profiles available:
Count   Profile
62  allocs
0   block
0   cmdline
109 goroutine
62  heap
0   mutex
0   profile
16  threadcreate
0   trace

Below are the heap info at Timestamp 1 & 2 https://file.io/YdSLRVGIBa7N

How can i determine why this memory consumption is increasing? Could this also be an issue with GC (memory not being released to OS)? I am on go version 1.20.2.

0

There are 0 best solutions below