Is there a memory leak?

Aperta
#1,436 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
backend

Direzione di ricerca

Start by reproducing the reported growth with the linked Godbolt example, then trace how repeated assignments to YAML::Node manage shared memory. Compare memory use across iterations and identify whether retained allocations come from the node assignment path; done means the behavior is explained and, if confirmed as a leak, a focused regression test demonstrates the fix.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi,

I am using yaml-cpp for parsing/emitting YAML because it is very simple and flexible as it comes with many predefined type conversions which can easily be extended.
However, the behaviour of the underlying shared memory management is surprising to say the least: in a simple example as the following, the memory usage will increase out of bounds (several GBytes before the program gets killed).

YAML::Node node;
node["test"] = 42;
for(auto i=0; i<10000000; ++i) {
node["test"] = 42;
}

There is a live repro here: https://godbolt.org/z/4PWezz16r. I first issued an open question on stackoverflow here: https://stackoverflow.com/staging-ground/79939206

While the example is rather artificial, we have cases where we read and override configuration data (YAML) many times, and having such behaviour as described above makes us hesitate to use yaml-cpp.

Thanks for any hints on this. Cheers,
Ralf

Lingua principale
C++
Stelle
6.1k
Fork
2.2k
Merge medio
22h 2m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jbeder/yaml-cpp

Tutte le issue di jbeder/yaml-cpp

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.