[Soc-2005-dev] Booleans: memory leaks

Chris Want cwant at ualberta.ca
Sun Sep 4 22:13:07 CEST 2005


Hi Marc,

I was investigating the issues reported on the
testing build forums, so I thought I'd try running
valgrind on the boolean branch. It appears there are
a few memory leaks, mostly related to code in BOP_merge.cpp.

Below is some of the relevant information, based
on a session where I created a UV sphere, then
unioned with a cube.

Chris

==28586== More than 300 different errors detected.  I'm not reporting 
any more.
==28586== Final error counts will be inaccurate.  Go fix your program!
==28586== Rerun with --error-limit=no to disable this cutoff.  Note
==28586== that errors may occur in your program without prior warning from
==28586== Valgrind, because errors are no longer being displayed.
==28586==
Using Python version 2.3
Saved session recovery to /tmp/quit.blend

Blender quit
==28586==
==28586== ERROR SUMMARY: 5239 errors from 300 contexts (suppressed: 2 
from 2)
==28586== malloc/free: in use at exit: 953511 bytes in 554 blocks.
==28586== malloc/free: 73412 allocs, 72858 frees, 27209379 bytes allocated.
==28586== For counts of detected errors, rerun with: -v
==28586== searching for pointers to 554 not-freed blocks.
==28586== checked 3483932 bytes.
==28586==
==28586==
==28586== 128 bytes in 2 blocks are definitely lost in loss record 65 of 112
==28586==    at 0x1B904727: operator new(unsigned) (vg_replace_malloc.c:132)
==28586==    by 0x82A5F28: BOP_Merge::mergeFaces(BOP_Face4*, BOP_Face3*, 
std::vector<unsigned, std::allocator<unsigned> >&, unsigned) 
(BOP_Merge.cpp:503)
==28586==    by 0x82A524C: BOP_Merge::mergeFaces(BOP_Face*, BOP_Face*, 
std::vector<unsigned, std::allocator<unsigned> >&, unsigned) 
(BOP_Merge.cpp:370)
==28586==    by 0x82A5098: BOP_Merge::mergeFaces(std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<unsigned, 
std::allocator<unsigned> >&, unsigned) (BOP_Merge.cpp:245)
==28586==    by 0x82A4222: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (stl_iterator.h:602)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==
==28586==
==28586== 128 bytes in 2 blocks are definitely lost in loss record 66 of 112
==28586==    at 0x1B904727: operator new(unsigned) (vg_replace_malloc.c:132)
==28586==    by 0x82A5491: BOP_Merge::mergeFaces(BOP_Face3*, BOP_Face3*, 
unsigned) (BOP_Merge.cpp:410)
==28586==    by 0x82A5285: BOP_Merge::mergeFaces(BOP_Face*, BOP_Face*, 
std::vector<unsigned, std::allocator<unsigned> >&, unsigned) 
(BOP_Merge.cpp:364)
==28586==    by 0x82A5098: BOP_Merge::mergeFaces(std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<unsigned, 
std::allocator<unsigned> >&, unsigned) (BOP_Merge.cpp:245)
==28586==    by 0x82A4222: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (stl_iterator.h:602)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==
==28586==
==28586== 192 bytes in 3 blocks are definitely lost in loss record 73 of 112
==28586==    at 0x1B904727: operator new(unsigned) (vg_replace_malloc.c:132)
==28586==    by 0x82A6280: BOP_Merge::mergeFaces(BOP_Face4*, BOP_Face3*, 
std::vector<unsigned, std::allocator<unsigned> >&, unsigned) 
(BOP_Merge.cpp:487)
==28586==    by 0x82A524C: BOP_Merge::mergeFaces(BOP_Face*, BOP_Face*, 
std::vector<unsigned, std::allocator<unsigned> >&, unsigned) 
(BOP_Merge.cpp:370)
==28586==    by 0x82A5098: BOP_Merge::mergeFaces(std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<unsigned, 
std::allocator<unsigned> >&, unsigned) (BOP_Merge.cpp:245)
==28586==    by 0x82A4222: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (stl_iterator.h:602)
==28586==    by 0x82A4019: BOP_Merge::mergeFaces() (BOP_Merge.cpp:87)
==28586==    by 0x82A3EEE: BOP_Merge::mergeFaces(BOP_Mesh*, unsigned) 
(BOP_Merge.cpp:59)
==28586==    by 0x829ED8B: BOP_intersectionBoolOp(BOP_Mesh*, 
std::vector<BOP_Face*, std::allocator<BOP_Face*> >*, 
std::vector<BOP_Face*, std::allocator<BOP_Face*> >*, bool, bool) 
(BOP_Merge.h:67)
==28586==    by 0x829EA5C: BOP_performBooleanOperation(EnumBoolOpType, 
CSG_MeshPropertyDescriptor, BSP_CSGMesh**, CSG_MeshPropertyDescriptor, 
CSG_FaceIteratorDescriptor, CSG_VertexIteratorDescriptor, 
CSG_MeshPropertyDescriptor, CSG_FaceIteratorDescriptor, 
CSG_VertexIteratorDescriptor, int (*)(void*, void*, void*, float)) 
(BOP_Interface.cpp:125)
==28586==    by 0x8295F61: CSG_PerformBooleanOperation 
(CSG_BooleanOps.cpp:142)
==28586==    by 0x81D6EDA: NewBooleanMesh (booleanops.c:505)
==28586==    by 0x811BE0D: special_editmenu (in 
/scratch/tmp/mfreixas/soc-blender/obj/linux-glibc2.3.5-i386/bin/blender)
==28586==
==28586==
==28586== 192 bytes in 3 blocks are definitely lost in loss record 74 of 112
==28586==    at 0x1B904727: operator new(unsigned) (vg_replace_malloc.c:132)
==28586==    by 0x82A5565: BOP_Merge::mergeFaces(BOP_Face3*, BOP_Face3*, 
unsigned) (BOP_Merge.cpp:403)
==28586==    by 0x82A5285: BOP_Merge::mergeFaces(BOP_Face*, BOP_Face*, 
std::vector<unsigned, std::allocator<unsigned> >&, unsigned) 
(BOP_Merge.cpp:364)
==28586==    by 0x82A5098: BOP_Merge::mergeFaces(std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<BOP_Face*, 
std::allocator<BOP_Face*> >&, std::vector<unsigned, 
std::allocator<unsigned> >&, unsigned) (BOP_Merge.cpp:245)
==28586==    by 0x82A4222: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (stl_iterator.h:602)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==    by 0x82A42A9: BOP_Merge::mergeFaces(std::vector<unsigned, 
std::allocator<unsigned> >&) (BOP_Merge.cpp:182)
==28586==
==28586==
==28586== 262140 bytes in 1 blocks are possibly lost in loss record 111 
of 112
==28586==    at 0x1B90459D: malloc (vg_replace_malloc.c:130)
==28586==    by 0x1BB61F58: (within /usr/lib/libGL.so.1.0.7174)
==28586==
==28586== LEAK SUMMARY:
==28586==    definitely lost: 640 bytes in 10 blocks.
==28586==      possibly lost: 262140 bytes in 1 blocks.
==28586==    still reachable: 690731 bytes in 543 blocks.
==28586==         suppressed: 0 bytes in 0 blocks.
==28586== Reachable blocks (those to which a pointer was found) are not 
shown.
==28586== To see them, rerun with: --show-reachable=yes


More information about the Soc-2005-dev mailing list