allegro / allegro/bigcache

Memory Leak?

オープン
#407 コメント 3 件 リアクション 2 件 担当者 0 名 GitHub で見る
bug question
主要言語
Go
スター
8.2k
フォーク
614
平均マージ
5日 12時間
マージ済み PR(30日)
1

説明

Question:

Why does the memory usage of BigCache keep growing in the following code? The function handling HTTP requests does not involve any BigCache read or write operations.
Every time this program runs, the memory usage quickly increases to around 10GB.

Go Version:1.23
Go Mod:
```
go 1.23

require (
github.com/allegro/bigcache/v3 v3.1.0
github.com/gin-gonic/gin v1.10.0
)
```

My Code:
```
package main

import (
"context"
"github.com/allegro/bigcache/v3"
"github.com/gin-gonic/gin"
"net/http"
)

var localBigCache *bigcache.BigCache

func init() {
lbc, _ := bigcache.New(context.Background(), bigcache.Config{
Shards: 1024,
LifeWindow: 0,
CleanWindow: 0,
MaxEntriesInWindow: 1024 * 6,
MaxEntrySize: 1024 * 100,
StatsEnabled: false,
Verbose: true,
HardMaxCacheSize: 0,
})

localBigCache = lbc
}

func main() {
r := gin.New()
r.GET("/test", func(c *gin.Context) {
c.String(200, "hello world")
})

srv := &http.Server{
Handler: r,
}

if err := srv.ListenAndServe(); err != nil {
panic(err)
}
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。