From a2379f0a4c53bbc325ee7e0f699d7414e4bd1f82 Mon Sep 17 00:00:00 2001 From: xiezhengyao Date: Fri, 13 Sep 2024 15:41:17 +0800 Subject: [PATCH] fix: cache mem too large --- pkg/proc/mem.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/proc/mem.go b/pkg/proc/mem.go index 0769f6c..5ae2a80 100644 --- a/pkg/proc/mem.go +++ b/pkg/proc/mem.go @@ -19,7 +19,10 @@ import ( "github.com/go-delve/delve/pkg/proc" ) -const cacheEnabled = true +const ( + cacheEnabled = true + cacheThreshold = 1024 * 1024 * 1024 // 1GB +) type memCache struct { loaded bool @@ -68,6 +71,9 @@ func cacheMemory(mem proc.MemoryReadWriter, addr uint64, size int) proc.MemoryRe // overflow return mem } + if size > cacheThreshold { + return mem + } switch cacheMem := mem.(type) { case *memCache: if cacheMem.contains(addr, size) {