[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

sletning af stl vector indeholdende dynamisk allokeret array



lang lang title. 
Jeg har et lidt mystisk problem mht til new og delete operatorene. Jeg har
en stl vektor der indeholder objekter der har brugt new operatoren.
Problemet er at jeg gerne vil kunne opdatere vektoren. Jeg bruger clear()
og bygger hele vektoren op igen med andre objekter, men der opstår en
memory-leak fordi de dynamisk allokerede områder ikke bliver slettet. Hvis
jeg bruger "delete []" i objekternes destructor'en hænger programmet når
vektoren skal oprettes .... jeg aner ikke hvorfor ? . 
Jeg kan undgå hukommelses-lækken hvis jeg laver en clean-funktion i
objekterne der ryder hukommelsen med "delete[]" før jeg kalder clear(). Men
det får programmet til at hænge i en "new" der bliver kaldt efter vektoren
er oprettet. Jeg er ikke god til at bruge debuggere, men programmet hænger
vist i funktionen "posix_memalign". Det har virket, så det er en bug i mit
program , men er der nogle der prøvet noget ligende som kan fortælle mig
hvor jeg skal lede.

hilsen rune


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *