mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-08-25 20:48:28 +00:00
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:
@@ -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();
|
||||
|
||||
|
||||
2
setup.py
2
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=
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -481,7 +481,7 @@ public:
|
||||
|
||||
buffer[9] = '3';
|
||||
buffer[10] = '2';
|
||||
buffer[11] = '3';
|
||||
buffer[11] = '4';
|
||||
}
|
||||
|
||||
virtual void startSerialization()
|
||||
|
||||
Reference in New Issue
Block a user