Possible memory leak: Tensor.Close returns early on the CUDA path and skips two frees
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- performance
Direzione di ricerca
Leggi go/dlpack.go intorno alla riga 184 e traccia Tensor.Close insieme alle allocazioni in NewTensorOnDevice. Verifica che il percorso CUDA continui a rilasciare il shape array e DLManagedTensor dopo la pulizia del dispositivo, quindi esegui i percorsi di creazione dell'indice e di ricerca per confermare che i tensori GPU non conservino più quelle allocazioni sull'host.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Possible memory leak: Tensor.Close returns early on the CUDA path and skips two frees
Close handles the device data in the kDLCUDA branch and returns from inside
it, so the shared cleanup below the branch never runs for GPU tensors.
go/dlpack.go:184
func (t *Tensor[T]) Close() error {
if t.C_tensor.dl_tensor.device.device_type == C.kDLCUDA {
bytes := t.sizeInBytes()
res, err := NewResource(nil)
if err != nil {
return err
}
err = CheckCuvs(CuvsError(C.cuvsRMMFree(res.Resource, t.C_tensor.dl_tensor.data, C.size_t(bytes))))
return err
} else if t.C_tensor.dl_tensor.device.device_type == C.kDLCPU {
if t.C_tensor.dl_tensor.data != nil {
C.free(t.C_tensor.dl_tensor.data)
t.C_tensor.dl_tensor.data = nil
}
}
if t.C_tensor.dl_tensor.shape != nil {
C.free(unsafe.Pointer(t.C_tensor.dl_tensor.shape))
t.C_tensor.dl_tensor.shape = nil
}
if t.C_tensor != nil {
C.free(unsafe.Pointer(t.C_tensor))
t.C_tensor = nil
}
Both skipped frees release host memory that NewTensorOnDevice allocated with
C.malloc:
shapePtr := C.malloc(C.size_t(len(shape) * int(unsafe.Sizeof(C.int64_t(0)))))
...
dlm := (*C.DLManagedTensor)(C.malloc(C.size_t(unsafe.Sizeof(C.DLManagedTensor{}))))
The CPU branch falls through and frees all three, which is what makes the CUDA
path stand out. Every GPU tensor therefore leaks len(shape)*8 bytes for the
shape array plus one DLManagedTensor on the host, and these are created per
index build and per search.
Fix: replace the return err in the CUDA branch with an assignment to a named
error, and let control fall through to the shape and tensor frees.
If you could credit me as a reporter for my contributions to security advisory I will be thankful.
- Lingua principale
- Cuda
- Stelle
- 869
- Fork
- 243
- Merge medio
- 3g 15h
- PR unite (30g)
- 78
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/cuvs
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 2 giorni
-
[BUG] cuVS Bench Faiss CAGRA b_ratio reads the wrong JSON keyForse già presa @arcusbuilds l’ha presa 16 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 2 giorni
-
doc
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
Upgrade faiss to v1.15.1Apertafaiss improvement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 2 giorni
Issue simili
-
Select the next clue in SQLApertaarea:drills phase:3 refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
sean-garwood/j_trainer#149 ·
-
type/automation type/performance
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Kozea/WeasyPrint#2983 ·
I maintainer di solito rispondono entro 1 giorno
-
[MOBILE] Add search input debounce (300ms) to event discovery screenForse già presa @iorchirmyom-afk l’ha presa oggi. Apertagood first issue mobile performance Stellar Wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Agora-Events/agora#1666 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
DX/Feature: User PaginationApertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
UTDallasEPICS/Rainbow-Roundup-Calendar-Event-App#449 ·
I maintainer di solito rispondono entro 1 giorno