Instances of ALLOCA in quickstep.cpp and collision_space.cpp do not have corresponding calls to UNALLOCA. This means that defining dUSE_MALLOC_FOR_ALLOCA will cause memory leaks.
A quick look in collision_space.cpp and quickstep.cpp I found that ALLOCA is a macro define in
collision_space_internal.h or at the top of quickstep.cpp.
define ALLOCA(x) dALLOCA16(x)
and dALLOCA16 is found in common.h
/ alloca aligned to the EFFICIENT_ALIGNMENT. note that this can waste
* up to 15 bytes per allocation, depending on what alloca() returns. /
So there should be no problem in
collision_space.cpp and quickstep.cpp
N.B. The file step.cpp redefine ALLOCA to use malloc if #ifdef dUSE_MALLOC_FOR_ALLOCA
is define so in that case there should be a free called (or the macro UNALLOCA)
I don't see any bug in this. I think this bug could be closed.
Remi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Apologies, I'd not traced through all the redefinitions of ALLOCA. I think a bug still stands, however, and that is that dUSE_MALLOC_FOR_ALLOCA does not behave as documented in all cases.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
--- old+++ new@@ -1,2 +1 @@-
Instances of ALLOCA in quickstep.cpp and collision_space.cpp do not have corresponding calls to UNALLOCA. This means that defining dUSE_MALLOC_FOR_ALLOCA will cause memory leaks.
status: open --> closed
Group: --> general
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=145206
Originator: NO
Hi,
A quick look in collision_space.cpp and quickstep.cpp I found that ALLOCA is a macro define in
collision_space_internal.h or at the top of quickstep.cpp.
define ALLOCA(x) dALLOCA16(x)
and dALLOCA16 is found in common.h
/ alloca aligned to the EFFICIENT_ALIGNMENT. note that this can waste
* up to 15 bytes per allocation, depending on what alloca() returns.
/
define dALLOCA16(n) \
((char*)dEFFICIENT_SIZE(((size_t)(alloca((n)+(EFFICIENT_ALIGNMENT-1))))))
So there should be no problem in
collision_space.cpp and quickstep.cpp
N.B. The file step.cpp redefine ALLOCA to use malloc if #ifdef dUSE_MALLOC_FOR_ALLOCA
is define so in that case there should be a free called (or the macro UNALLOCA)
I don't see any bug in this. I think this bug could be closed.
Remi
Logged In: YES
user_id=1768899
Originator: YES
Apologies, I'd not traced through all the redefinitions of ALLOCA. I think a bug still stands, however, and that is that dUSE_MALLOC_FOR_ALLOCA does not behave as documented in all cases.
This is not issue any more as both ALLOCA and dUSE_MALLOC_FOR_ALLOCA have been removed from dWorldStep().
Well, the problem with collision_space.cpp still remains
Diff:
This is probably outdated since Oleh changed all the allocation code.
Moved to http://bitbucket.org/odedevs/ode/issue/17/memory-leaks-on-duse_malloc_for_alloca