Merge pull request #4252 from erwincoumans/master

manually copy data, to avoid possible memory leaks.
Thanks to Jason Peng and Gilbert Feng for the report and reproduction case.
This commit is contained in:
erwincoumans
2022-04-25 19:39:24 -07:00
committed by GitHub
6 changed files with 27 additions and 6 deletions

View File

@@ -1 +1 @@
3.23
3.24

View File

@@ -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();

View File

@@ -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=

View File

@@ -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)

View File

@@ -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()
{

View File

@@ -481,7 +481,7 @@ public:
buffer[9] = '3';
buffer[10] = '2';
buffer[11] = '3';
buffer[11] = '4';
}
virtual void startSerialization()