summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerwincoumans <erwin.coumans@gmail.com>2022-04-25 19:39:24 -0700
committerGitHub <noreply@github.com>2022-04-25 19:39:24 -0700
commit7dee3436e747958e7088dfdcea0e4ae031ce619e (patch)
treef03ef41cd7e3bd9cda4ae64a9b3e3b26830d1cb9
parente95657f80fcaccf2c83db3166d845c59d2cd2d2d (diff)
parent657f3472239e53fb8f2932181ae8d723344a6f35 (diff)
downloadbullet3-7dee3436e747958e7088dfdcea0e4ae031ce619e.tar.gz
Merge pull request #4252 from erwincoumans/master3.24
manually copy data, to avoid possible memory leaks. Thanks to Jason Peng and Gilbert Feng for the report and reproduction case.
-rw-r--r--VERSION2
-rw-r--r--examples/SharedMemory/PhysicsServerCommandProcessor.cpp13
-rw-r--r--setup.py2
-rw-r--r--src/Bullet3Common/b3AlignedObjectArray.h12
-rw-r--r--src/LinearMath/btScalar.h2
-rw-r--r--src/LinearMath/btSerializer.h2
6 files changed, 27 insertions, 6 deletions
diff --git a/VERSION b/VERSION
index 0f4de9d99..bd2342316 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.23
+3.24
diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp
index d3f1ee799..8275451ed 100644
--- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp
+++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp
@@ -240,6 +240,10 @@ struct InternalVisualShapeData
b3AlignedObjectArray<std::string> m_pathPrefixes;
+ virtual ~InternalVisualShapeData()
+ {
+ clear();
+ }
void clear()
{
m_tinyRendererVisualShapeIndex = -1;
@@ -259,8 +263,14 @@ struct InternalCollisionShapeData
m_used(0)
{
}
+
+ virtual ~InternalCollisionShapeData()
+ {
+ clear();
+ }
void clear()
{
+ m_urdfCollisionObjects.clear();
m_collisionShape = 0;
m_used = 0;
}
@@ -15949,6 +15959,9 @@ void PhysicsServerCommandProcessor::resetSimulation(int flags)
m_data->m_bodyHandles.exitHandles();
m_data->m_bodyHandles.initHandles();
+ m_data->m_userVisualShapeHandles.exitHandles();
+ m_data->m_userVisualShapeHandles.initHandles();
+
m_data->m_userCollisionShapeHandles.exitHandles();
m_data->m_userCollisionShapeHandles.initHandles();
diff --git a/setup.py b/setup.py
index 21a6c2d2f..86a7a9cbe 100644
--- a/setup.py
+++ b/setup.py
@@ -505,7 +505,7 @@ if 'BT_USE_EGL' in EGL_CXX_FLAGS:
setup(
name='pybullet',
- version='3.2.3',
+ version='3.2.4',
description=
'Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning',
long_description=
diff --git a/src/Bullet3Common/b3AlignedObjectArray.h b/src/Bullet3Common/b3AlignedObjectArray.h
index 7d31b56d0..8ef3331f7 100644
--- a/src/Bullet3Common/b3AlignedObjectArray.h
+++ b/src/Bullet3Common/b3AlignedObjectArray.h
@@ -135,7 +135,11 @@ public:
int otherSize = otherArray.size();
resize(otherSize);
- otherArray.copy(0, otherSize, m_data);
+ //don't use otherArray.copy, it can leak memory
+ for (int i = 0; i < otherSize; i++)
+ {
+ m_data[i] = otherArray[i];
+ }
}
/// return the number of elements in the array
@@ -506,7 +510,11 @@ public:
{
int otherSize = otherArray.size();
resize(otherSize);
- otherArray.copy(0, otherSize, m_data);
+ //don't use otherArray.copy, it can leak memory
+ for (int i = 0; i < otherSize; i++)
+ {
+ m_data[i] = otherArray[i];
+ }
}
void removeAtIndex(int index)
diff --git a/src/LinearMath/btScalar.h b/src/LinearMath/btScalar.h
index e27b71594..9f5408c79 100644
--- a/src/LinearMath/btScalar.h
+++ b/src/LinearMath/btScalar.h
@@ -25,7 +25,7 @@ subject to the following restrictions:
#include <float.h>
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
-#define BT_BULLET_VERSION 323
+#define BT_BULLET_VERSION 324
inline int btGetVersion()
{
diff --git a/src/LinearMath/btSerializer.h b/src/LinearMath/btSerializer.h
index 9c5525fb9..59695ab32 100644
--- a/src/LinearMath/btSerializer.h
+++ b/src/LinearMath/btSerializer.h
@@ -481,7 +481,7 @@ public:
buffer[9] = '3';
buffer[10] = '2';
- buffer[11] = '3';
+ buffer[11] = '4';
}
virtual void startSerialization()