-
Notifications
You must be signed in to change notification settings - Fork 555
Open
Description
Hi there,
I use ConcurrentMap to story symbols data, if use Upsert function, there are memory leak; if use Set function, it is fine.
Can you please take a look at this? thank you.
a.go maybe memory leak in the callback function: ExistSymbolCB
var SymbolMap camp.ConcurrentMap[string, libSymbol.GenericSymbol]
SymbolMap.Upsert(key, genSym, ExistSymbolCB)
...
func ExistSymbolCB(exists bool, valueInMap libSymbol.GenericSymbol, newValue libSymbol.GenericSymbol) libSymbol.GenericSymbol {
if exists {
valueInMap.Session = newValue.Session
return valueInMap
}
return newValue
}
b.go, no memory leak in Set function
var SymbolMap camp.ConcurrentMap[string, libSymbol.GenericSymbol]
...
if existSym, ok := SymbolMap.Get(key); ok {
existSym.Session = genSym.Session
SymbolMap.Set(key, existSym)
} else {
// new Symbol config
SymbolMap.Set(key, genSym)
}
Metadata
Metadata
Assignees
Labels
No labels