Revision: 1674
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1674&view=rev
Author: rorthomas
Date: 2011-02-13 15:09:09 +0000 (Sun, 13 Feb 2011)
Log Message:
-----------
found and fixed severe memory problem with commands
Modified Paths:
--------------
trunk/source/main/physics/Beam.cpp
trunk/source/main/physics/input_output/BeamLoadTruck.cpp
Modified: trunk/source/main/physics/Beam.cpp
===================================================================
--- trunk/source/main/physics/Beam.cpp 2011-02-13 14:54:15 UTC (rev 1673)
+++ trunk/source/main/physics/Beam.cpp 2011-02-13 15:09:09 UTC (rev 1674)
@@ -6,7 +6,7 @@
For more information, see http://www.rigsofrods.com/
Rigs of Rods is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 3, as
+it under the terms of the GNU General Public License version 3, as
published by the Free Software Foundation.
Rigs of Rods is distributed in the hope that it will be useful,
@@ -321,7 +321,16 @@
ties.clear();
hooks.clear();
memset(this->wings, 0, sizeof(wing_t) * MAX_WINGS); free_wing = 0;
- memset(this->commandkey, 0, sizeof(command_t) * (MAX_COMMANDS + 1));
+
+ // commands contain complex data structures, do not memset them ...
+ for(int i=0;i<MAX_COMMANDS+1;i++)
+ {
+ this->commandkey[i].commandValue=-1;
+ this->commandkey[i].beams.clear();
+ this->commandkey[i].rotators.clear();
+ this->commandkey[i].description = String();
+ }
+
memset(this->rotators, 0, sizeof(rotator_t) * MAX_ROTATORS);
free_rotator = 0;
flares.clear(); free_flare = 0;
memset(this->props, 0, sizeof(prop_t) * MAX_PROPS); free_prop = 0;
@@ -1697,7 +1706,7 @@
}
position = aposition / free_node;
}
-
+
}
void Beam::resetAngle(float rot)
@@ -5277,7 +5286,7 @@
t.node =
tsm->getRootSceneNode()->createChildSceneNode();
t.node->attachObject(t.txt);
t.node->attachObject(b);
-
+
float f = 0.05f;
if(nodes[i].collRadius > 0.00001)
{
Modified: trunk/source/main/physics/input_output/BeamLoadTruck.cpp
===================================================================
--- trunk/source/main/physics/input_output/BeamLoadTruck.cpp 2011-02-13
14:54:15 UTC (rev 1673)
+++ trunk/source/main/physics/input_output/BeamLoadTruck.cpp 2011-02-13
15:09:09 UTC (rev 1674)
@@ -348,7 +348,6 @@
if (!strncmp("add_animation", line, 13))
{
- printf(">>> add_animation\n");
/*
* this command has several layers for splitting up the
line:
* 1. ',' the top level will be split up with a comma
to separate the main options
@@ -1333,7 +1332,6 @@
}
else if (mode==66)
{
- printf(">>> animators\n");
//parse animators
int id1, id2;
float ratio;
@@ -1565,7 +1563,6 @@
else if (mode==9)
{
//parse engine
- printf(">>> engine\n");
if(driveable == MACHINE)
continue;
@@ -1803,14 +1800,14 @@
if(strlen(descr) != 0)
commandkey[keys].description = String(descr);
- else if (strlen(descr) == 0 &&
commandkey[keys].description.size() == 0)
+ else if (strlen(descr) == 0 &&
commandkey[keys].description.empty())
commandkey[keys].description = "";
//add long key
commandkey[keyl].beams.push_back(pos);
if(strlen(descr) != 0)
commandkey[keyl].description = String(descr);
- else if (strlen(descr) == 0 &&
commandkey[keyl].description.size() == 0)
+ else if (strlen(descr) == 0 &&
commandkey[keyl].description.empty())
commandkey[keyl].description = "";
LogManager::getSingleton().logMessage("added command:
short=" + StringConverter::toString(keys)+ ", long=" +
StringConverter::toString(keyl) + ", descr=" + (descr));
@@ -2981,7 +2978,6 @@
else if (mode==34)
{
// parse exhausts
- printf(">>> exhausts\n");
if (disable_smoke)
continue;
int id1, id2;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel