Replace new/delete calls for Block* with malloc and free
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 30/100
Direzione di ricerca
The change sits in the MemPoolT template, which allocates and frees its Block* objects with new and delete; start by reading its block allocation and teardown code in tinyxml2.h. The reporter's workaround swaps in malloc and free, but the thread does not settle whether that is the right fix or whether the real problem is destruction order with a custom global allocator. Before editing, confirm that direction with a maintainer. Done means the pool's block lifetime is correct under overridden operator new and delete, with the existing tests still passing.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hello,
I am writing a program in which the new and delete operators are overloaded in order to use a custom allocator, and I found that the new and delete calls to allocate and deallocate memory for Block* in MemPoolT was causing several memory issues. I fixed these by replacing these with malloc() and free(). I'm not sure exactly why these issues were occurring.
EDIT: I believe this is because my allocator deconstructed the memory before the memory pool, meaning the memory pool was trying to deallocate memory that no longer exists
- Lingua principale
- C++
- Stelle
- 5.8k
- Fork
- 2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 leethomason/tinyxml2
-
XMLNode::InsertAfterChild dereferences NULL when addThis is already afterThis's next siblingForse già presa @zhouyunding l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
leethomason/tinyxml2#1101 ·
-
CDATA output containing ]]> is not well-formed XMLForse già presa @bconnnnn l’ha presa 20 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
leethomason/tinyxml2#1097 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
leethomason/tinyxml2#923 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
leethomason/tinyxml2#914 ·
-
New release requestAperta
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 15/100
leethomason/tinyxml2#1087 · 4 commenti ·
Tutte le issue di leethomason/tinyxml2
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 3 giorni
-
status:needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
PX4/PX4-Autopilot#29496 ·
I maintainer di solito rispondono entro 1 giorno
-
Missing icon for .cpp2 filesAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
madskristensen/FileIcons#385 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
microsoft/SysmonCommon#26 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
espressif/esp-matter#1913 ·