On 01/19/2008 03:40 AM, Tim Moore wrote: >> Actually, we want to avoid writing explicit deletes as much as possible, as >> that >> need is the source of most memory leaks.
Yes indeed. >> We have two classes for smart, reference- >> counted pointers, osg::ref_ptr and SGSharedPtr which should be used for all >> long-lived, >> shared objects. It's unfortunate that there are two choices, and I've >> contemplated >> removing the simgear version in favor of OSG, but I think SGSharedPtr has >> some >> performance advantages in multi-threaded situations. Anyway, use >> osg::ref_ptr for >> scene-graph related stuff. That's good advice. Forsooth it would make sense to *start* by cleaning up the source i.e. getting rid of needlessly non-automatic memory management (rather than starting with valgrind), for several reasons: a) It's just plain easier to look at the source than to look at the valgrind output. Valgrind can see the mess left behind by buggy code, but it doesn't tell you which line of code is buggy. b) Cleaning up the code is at least as effective, possibly more effective at fixing memory leaks. c) It's the Right Thing to do anyway. Beyond fixing memory leaks, it has the side-effect of making the code more readable, more re-usable, more extensible, et cetera. >> osg::ref_ptr and SGSharedPtr which should be used for all long-lived, >> shared objects. Ah, "should be". There is presently a noticeable gap between what "is" and what "should be". Examples of non-automatic memory management include: AIModel/AIAircraft.cxx: FGAIFlightPlan* fp = new FGAIFlightPlan(flightplan); AIModel/AICarrier.hxx: FGAICarrierHardware* ch = new FGAICarrierHardware; AIModel/AICarrier.hxx: FGAICarrierHardware* ch = new FGAICarrierHardware; AIModel/AICarrier.hxx: FGAICarrierHardware* ch = new FGAICarrierHardware; AIModel/AIFlightPlanCreateCruise.cxx: init_waypoint = new waypoint; AIModel/AIFlightPlanCreateCruise.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreateCruise.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreateCruise.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreateCruise.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreate.cxx: taxiRoute = new FGTaxiRoute; AIModel/AIFlightPlanCreate.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreate.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreate.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreate.cxx: wpt = new waypoint; ... AIModel/AIFlightPlanCreatePushBack.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreatePushBack.cxx: parking->setPushBackRoute(new FGTaxiRoute(route)); AIModel/AIFlightPlanCreatePushBack.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreatePushBack.cxx: wpt = new waypoint; AIModel/AIFlightPlanCreatePushBack.cxx: wpt = new waypoint; ... AIModel/AIFlightPlan.cxx: waypoint* wpt = new waypoint; AIModel/AIFlightPlan.cxx: waypoint* wpt = new waypoint; AIModel/AIFlightPlan.cxx: waypoint* init_waypoint = new waypoint; AIModel/AIFlightPlan.cxx: waypoint *wpt = new waypoint; AIModel/AIManager.cxx: FGAITanker* tanker = new FGAITanker; AIModel/AIManager.cxx: FGAIAircraft* aircraft = new FGAIAircraft; AIModel/AIManager.cxx: FGAIShip* ship = new FGAIShip; AIModel/AIManager.cxx: FGAICarrier* carrier = new FGAICarrier; AIModel/AIManager.cxx: FGAIStorm* storm = new FGAIStorm; ... AIModel/AIShip.cxx: FGAIFlightPlan* fp = new FGAIFlightPlan(flightplan); AIModel/submodel.cxx: FGAIBallistic* ballist = new FGAIBallistic; AIModel/submodel.cxx: submodel* sm = new submodel; AIModel/submodel.cxx: submodel* sm = new submodel; Aircraft/aircraft.cxx: globals->set_aircraft_model(new FGAircraftModel); Airports/groundnetwork.cxx: segments.push_back(new FGTaxiSegment(seg)); Airports/groundnetwork.cxx: nodes.push_back(new FGTaxiNode(node)); Airports/groundnetwork.cxx: nodes.push_back(new FGTaxiNode(n)); Airports/simple.cxx: _dynamics = new FGAirportDynamics(this); Airports/simple.cxx: FGAirport* a = new FGAirport(id, location, tower_location, name, has_metar, ATC/AILocalTraffic.cxx: node* np = new node; ATC/AIMgr.cxx: ID_list_type* apts = new ID_list_type; ATC/AIMgr.cxx: FGAIGAVFRTraffic* p = new FGAIGAVFRTraffic(); ATC/AIMgr.cxx: FGAILocalTraffic* local_traffic = new FGAILocalTraffic; ATC/AIMgr.cxx: FGAIGAVFRTraffic* t = new FGAIGAVFRTraffic(); ATC/AIMgr.cxx: FGAIGAVFRTraffic* t = new FGAIGAVFRTraffic(); ATC/AIPlane.cxx: SGSoundSample* simple = new SGSoundSample(buf, len, 8000); ATC/ATC.cxx: = new SGSoundSample(buf, len, 8000); ATC/ATCmgr.cxx: current_commlist = new FGCommList; ATC/ATCmgr.cxx: v1 = new FGATCVoice; ATC/ATCmgr.cxx: current_transmissionlist = new FGTransmissionList; ATC/ATCmgr.cxx: current_atcdialog = new FGATCDialog; ATC/ATCmgr.cxx: AirportATC *a = new AirportATC; ... ATC/ATCVoice.cxx: SoundData = new SGSoundSample(); ATC/ATCVoice.cxx: WordData* wdptr = new WordData[numWords]; ATC/ATCVoice.cxx: unsigned char* tmpbuf = new unsigned char[cumLength]; ATC/ATCVoice.cxx: unsigned char* outbuf = new unsigned char[cumLength]; ATC/ground.cxx: np = new node; ATC/ground.cxx: ap = new arc; ATC/ground.cxx: gp = new Gate; ATC/ground.cxx: pathPtr = new a_path; ATC/ground.cxx: pathPtr = new a_path; ... ATC/tower.cxx: ground = new FGGround(ident); ATC/tower.cxx: ground = new FGGround(ident); ATC/tower.cxx: ground = new FGGround(ident); ATC/tower.cxx: TowerPlaneRec* t = new TowerPlaneRec; ATC/tower.cxx: TowerPlaneRec* t = new TowerPlaneRec; ... Autopilot/route_mgr.cxx: route( new SGRoute ), Autopilot/route_mgr.cxx: listener(new Listener(this)), Autopilot/route_mgr.cxx: *wp = new SGWayPoint( lon, lat, alt, SGWayPoint::WGS84, target ); Autopilot/route_mgr.cxx: *wp = new SGWayPoint( apt->getLongitude(), apt->getLatitude(), alt, SGWayPoint::WGS84, target ); Autopilot/route_mgr.cxx: *wp = new SGWayPoint( f.get_lon(), f.get_lat(), alt, SGWayPoint::WGS84, target ); ... Autopilot/xmlauto.cxx: FGXMLAutoComponent *c = new FGPIDController( node ); Autopilot/xmlauto.cxx: FGXMLAutoComponent *c = new FGPISimpleController( node ); Autopilot/xmlauto.cxx: FGXMLAutoComponent *c = new FGPredictor( node ); Autopilot/xmlauto.cxx: FGXMLAutoComponent *c = new FGDigitalFilter( node ); Cockpit/built_in/FGMagRibbon.cxx: static osg::ref_ptr<osg::StateSet> stateSet = new osg::StateSet; Cockpit/hud.cxx: HIptr = static_cast<instr_item *>(new HudLadder(ladder_group->getChild(j))); Cockpit/hud.cxx: HIptr = static_cast<instr_item *>(new gauge_instr(card_group->getChild(j))); Cockpit/hud.cxx: HIptr = static_cast<instr_item *>(new hud_card(card_group->getChild(j))); Cockpit/hud.cxx: HIptr = static_cast<instr_item *>(new instr_label(label_group->getChild(j))); Cockpit/hud.cxx: HIptr = static_cast<instr_item *>(new fgTBI_instr(tbi_group->getChild(j))); ... Cockpit/panel.cxx: _texture = new osg::StateSet; Cockpit/panel.cxx: panelStateSet = new osg::StateSet; Cockpit/panel.cxx: panelStateSet->setAttributeAndModes(new osg::PolygonOffset(-1, -POFF_UNITS)); Cockpit/panel.cxx: osg::Material* material = new osg::Material; Cockpit/panel.cxx: panelStateSet->setAttributeAndModes(new osg::CullFace(osg::CullFace::BACK)); ... Cockpit/panel_io.cxx: FGPanelAction * action = new FGPanelAction(button, x, y, w, h, repeatable); Cockpit/panel_io.cxx: action->addBinding(new SGBinding(binding, globals->get_props()), 0); Cockpit/panel_io.cxx: action->addBinding(new SGBinding(binding, globals->get_props()), 1); Cockpit/panel_io.cxx: FGPanelTransformation * t = new FGPanelTransformation; Cockpit/panel_io.cxx: t->table = new SGInterpTable(trans_table); ... Environment/atmosphere.cxx: a_tvs_p = new SGInterpTable; Environment/environment_ctrl.cxx: bucket * b = new bucket; Environment/environment_ctrl.cxx: : env( new FGInterpolateEnvironmentCtrl ), Environment/environment_ctrl.cxx: thread = new MetarThread(this); Environment/environment_ctrl.cxx: result.m = new FGMetar( icao, host, port, auth); Environment/environment.cxx: _temperature_degc_table = new SGInterpTable; Environment/environment.cxx: _pressure_inhg_table = new SGInterpTable; Environment/environment_mgr.cxx: : _environment(new FGEnvironment) Environment/environment_mgr.cxx: _controller = new FGMetarEnvironmentCtrl; Environment/environment_mgr.cxx: _controller = new FGInterpolateEnvironmentCtrl; Environment/environment_mgr.cxx: fgClouds = new FGClouds( _controller ); Environment/fgclouds.cxx: last_env_config( new SGPropertyNode() ), Environment/fgclouds.cxx: last_env_clouds( new SGPropertyNode() ) Environment/fgclouds.cxx: snd_lightning = new SGSoundSample(globals->get_fg_root().c_str(), "Sounds/thunder.wav"); Environment/fgclouds.cxx: SGNewCloud *cld = new SGNewCloud(familly); Environment/fgclouds.cxx: FGMetar *m = new FGMetar( station + fakeMetar ); ... FDM/ExternalNet/ExternalNet.cxx: http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd ); FDM/ExternalNet/ExternalNet.cxx: http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd ); FDM/ExternalNet/ExternalNet.cxx: http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd ); FDM/ExternalNet/ExternalNet.cxx: http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd ); FDM/ExternalNet/ExternalNet.cxx: http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd ); ... FDM/ExternalPipe/ExternalPipe.cxx: buf = new char[MAX_BUF]; FDM/ExternalPipe/ExternalPipe.cxx: char *buf = new char[len + 3]; FDM/ExternalPipe/ExternalPipe.cxx: char *buf = new char[len + 1]; FDM/JSBSim/FGFDMExec.cpp: if (Root == 0) master= new FGPropertyManager; FDM/JSBSim/FGFDMExec.cpp: Atmosphere = new FGAtmosphere(this); FDM/JSBSim/FGFDMExec.cpp: FCS = new FGFCS(this); FDM/JSBSim/FGFDMExec.cpp: Propulsion = new FGPropulsion(this); FDM/JSBSim/FGFDMExec.cpp: MassBalance = new FGMassBalance(this); ... FDM/JSBSim/initialization/FGTrim.cpp: TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,state,control)); FDM/JSBSim/initialization/FGTrim.cpp: sub_iterations=new double[TrimAxes.size()]; FDM/JSBSim/initialization/FGTrim.cpp: successful=new double[TrimAxes.size()]; FDM/JSBSim/initialization/FGTrim.cpp: solution=new bool[TrimAxes.size()]; FDM/JSBSim/initialization/FGTrim.cpp: sub_iterations=new double[TrimAxes.size()]; ... FDM/JSBSim/input_output/FGScript.cpp: LocalProps *localProp = new LocalProps(); FDM/JSBSim/input_output/FGScript.cpp: newEvent = new struct event(); FDM/JSBSim/input_output/FGScript.cpp: newCondition = new FGCondition(condition_element, PropertyManager); FDM/JSBSim/input_output/FGXMLParse.cpp: document = new Element(Name); FDM/JSBSim/input_output/FGXMLParse.cpp: temp_element = new Element(Name); FDM/JSBSim/JSBSim.cxx: fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() ); FDM/JSBSim/JSBSim.cxx: fdmex->SetGroundCallback( new FGFSGroundCallback(this) ); FDM/JSBSim/JSBSim.cxx: fgtrim = new FGTrim(fdmex,tGround); FDM/JSBSim/JSBSim.cxx: fgtrim = new FGTrim(fdmex,tLongitudinal); FDM/JSBSim/math/FGFunction.cpp: Parameters.push_back(new FGPropertyValue( newNode )); FDM/JSBSim/math/FGFunction.cpp: Parameters.push_back(new FGRealValue(element->GetDataAsNumber())); FDM/JSBSim/math/FGFunction.cpp: Parameters.push_back(new FGTable(PropertyManager, element)); FDM/JSBSim/math/FGFunction.cpp: Parameters.push_back(new FGFunction(PropertyManager, element)); FDM/JSBSim/math/FGTable.cpp: Tables.push_back(new FGTable(PropertyManager, tableData)); FDM/JSBSim/math/FGTable.cpp: Data = new double*[nRows+1]; FDM/JSBSim/math/FGTable.cpp: Data[r] = new double[nCols+1]; FDM/JSBSim/models/FGAerodynamics.cpp: Coeff = new CoeffArray[6]; FDM/JSBSim/models/FGAerodynamics.cpp: AeroRPShift = new FGFunction(PropertyManager, function_element); FDM/JSBSim/models/FGAerodynamics.cpp: variables.push_back( new FGFunction(PropertyManager, function_element) ); FDM/JSBSim/models/FGAerodynamics.cpp: ca.push_back( new FGFunction(PropertyManager, function_element) ); FDM/JSBSim/models/FGFCS.cpp: interface_properties.push_back(new double(0)); FDM/JSBSim/models/FGFCS.cpp: sensors.push_back(new FGSensor(this, sensor_element)); FDM/JSBSim/models/FGFCS.cpp: Components->push_back(new FGFilter(this, component_element)); FDM/JSBSim/models/FGFCS.cpp: Components->push_back(new FGGain(this, component_element)); FDM/JSBSim/models/FGFCS.cpp: Components->push_back(new FGSummer(this, component_element)); ... FDM/JSBSim/models/FGInput.cpp: socket = new FGfdmSocket(port); FDM/JSBSim/models/FGLGear.cpp: ForceY_Table = new FGTable(Exec->GetPropertyManager(), force_table); FDM/JSBSim/models/FGOutput.cpp: socket = new FGfdmSocket(name, port); FDM/JSBSim/models/FGPropulsion.cpp: Engines.push_back(new FGPiston(FDMExec, document, numEngines)); FDM/JSBSim/models/FGPropulsion.cpp: Engines.push_back(new FGTurbine(FDMExec, document, numEngines)); FDM/JSBSim/models/FGPropulsion.cpp: Engines.push_back(new FGTurboProp(FDMExec, document, numEngines)); FDM/JSBSim/models/FGPropulsion.cpp: Engines.push_back(new FGRocket(FDMExec, document, numEngines)); FDM/JSBSim/models/FGPropulsion.cpp: Engines.push_back(new FGElectric(FDMExec, document, numEngines)); ... FDM/JSBSim/models/flight_control/FGFCSFunction.cpp: function = new FGFunction(PropertyManager, function_element); FDM/JSBSim/models/flight_control/FGGain.cpp: Table = new FGTable(PropertyManager, element->FindElement("table")); FDM/JSBSim/models/propulsion/FGEngine.cpp: Thruster = new FGPropeller(FDMExec, document, EngineNumber); FDM/JSBSim/models/propulsion/FGEngine.cpp: Thruster = new FGNozzle(FDMExec, document, EngineNumber); FDM/JSBSim/models/propulsion/FGEngine.cpp: Thruster = new FGThruster( FDMExec, document, EngineNumber); FDM/JSBSim/models/propulsion/FGPiston.cpp: Lookup_Combustion_Efficiency = new FGTable(12); FDM/JSBSim/models/propulsion/FGPiston.cpp: Power_Mixture_Correlation = new FGTable(13); FDM/JSBSim/models/propulsion/FGPropeller.cpp: cThrust = new FGTable(PropertyManager, table_element); FDM/JSBSim/models/propulsion/FGPropeller.cpp: cPower = new FGTable(PropertyManager, table_element); FDM/JSBSim/models/propulsion/FGRocket.cpp: ThrustTable = new FGTable(PropertyManager, thrust_table_element); FDM/JSBSim/models/propulsion/FGTurbine.cpp: IdleThrustLookup = new FGFunction(PropertyManager, function_element, property_prefix); FDM/JSBSim/models/propulsion/FGTurbine.cpp: MilThrustLookup = new FGFunction(PropertyManager, function_element, property_prefix); FDM/JSBSim/models/propulsion/FGTurbine.cpp: MaxThrustLookup = new FGFunction(PropertyManager, function_element, property_prefix); FDM/JSBSim/models/propulsion/FGTurbine.cpp: InjectionLookup = new FGFunction(PropertyManager, function_element, property_prefix); FDM/JSBSim/models/propulsion/FGTurboProp.cpp: EnginePowerVC = new FGTable(PropertyManager, table_element); FDM/JSBSim/models/propulsion/FGTurboProp.cpp: EnginePowerRPM_N1 = new FGTable(PropertyManager, table_element); FDM/JSBSim/models/propulsion/FGTurboProp.cpp: ITT_N1 = new FGTable(PropertyManager, table_element); FDM/LaRCsim/LaRCsim.cxx: lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is FDM/SP/ADA.cxx: fdmsock = new SGSocket( "fdm_pc", "5001", "udp" ); FDM/UFO.cxx: Throttle(new lowpass(fgGetDouble("/controls/damping/throttle", 0.1))), FDM/UFO.cxx: Aileron(new lowpass(fgGetDouble("/controls/damping/aileron", 0.65))), FDM/UFO.cxx: Elevator(new lowpass(fgGetDouble("/controls/damping/elevator", 0.65))), FDM/UFO.cxx: Rudder(new lowpass(fgGetDouble("/controls/damping/rudder", 0.05))), FDM/UFO.cxx: Aileron_Trim(new lowpass(fgGetDouble("/controls/damping/aileron-trim", 0.65))), ... FDM/UIUCModel/uiuc_1DdataFileReader.cpp: matrix = new ParseFile(file_name); FDM/UIUCModel/uiuc_1DdataFileReader.cpp: matrix = new ParseFile(file_name); FDM/UIUCModel/uiuc_2DdataFileReader.cpp: matrix = new ParseFile(file_name); FDM/UIUCModel/uiuc_flapdata.cpp: ifstream* f=new ifstream(filename); //open file for reading in text (ascii) mode FDM/UIUCModel/uiuc_flapdata.cpp: alphaArray=new double[alphaLength]; FDM/UIUCModel/uiuc_flapdata.cpp: speedArray=new double[speedLength]; FDM/UIUCModel/uiuc_flapdata.cpp: freqArray=new double[freqLength]; FDM/UIUCModel/uiuc_flapdata.cpp: phiArray=new double[phiLength]; ... FDM/UIUCModel/uiuc_menu.cpp: airplane = new ParseFile(aircraft_name); /* struct that includes all lines of the input file */ FDM/UIUCModel/uiuc_menu.cpp: initParts = new ParseFile(); FDM/UIUCModel/uiuc_menu.cpp: geometryParts = new ParseFile(); FDM/UIUCModel/uiuc_menu.cpp: massParts = new ParseFile(); FDM/UIUCModel/uiuc_menu.cpp: engineParts = new ParseFile(); ... FDM/UIUCModel/uiuc_menu_fog.cpp: fog_time = new double[fog_segments+1]; FDM/UIUCModel/uiuc_menu_fog.cpp: fog_value = new int[fog_segments+1]; FDM/UIUCModel/uiuc_menu_misc.cpp: flapper_data = new FlapData(flap_file.c_str()); FDM/UIUCModel/uiuc_wrapper.cpp: aircraft_ = new AIRCRAFT; FDM/YASim/Airplane.cpp: Control* c = new Control(); FDM/YASim/Airplane.cpp: Control* c = new Control(); FDM/YASim/Airplane.cpp: SolveWeight* w = new SolveWeight(); FDM/YASim/Airplane.cpp: Fuselage* f = new Fuselage(); FDM/YASim/Airplane.cpp: Tank* t = new Tank(); ... FDM/YASim/ControlMap.cpp: Vector* v = new Vector(); FDM/YASim/ControlMap.cpp: out = new OutRec(); FDM/YASim/ControlMap.cpp: MapRec* map = new MapRec(); FDM/YASim/FGFDM.cpp: _turb = new Turbulence(10, seed); FDM/YASim/FGFDM.cpp: SimpleJet* j = new SimpleJet(); FDM/YASim/FGFDM.cpp: Jet* j = new Jet(); FDM/YASim/FGFDM.cpp: EngRec* er = new EngRec(); FDM/YASim/FGFDM.cpp: Hitch* h = new Hitch(a->getValue("name")); ... FDM/YASim/Hitch.cpp: _state=new State; FDM/YASim/Model.cpp: _ground_cb = new Ground(); FDM/YASim/RigidBody.cpp: _masses = new Mass[_massesAlloced]; FDM/YASim/RigidBody.cpp: Mass *m2 = new Mass[_massesAlloced]; FDM/YASim/Rotor.cpp: Rotorpart *r = new Rotorpart(); FDM/YASim/Turbulence.cpp: float* xbuf = new float[_sz*_sz]; FDM/YASim/Turbulence.cpp: float* ybuf = new float[_sz*_sz]; FDM/YASim/Turbulence.cpp: float* zbuf = new float[_sz*_sz]; FDM/YASim/Turbulence.cpp: _data = new unsigned char[3*_sz*_sz]; FDM/YASim/Vector.hpp: void** array = new void*[_nelem]; FDM/YASim/Wing.cpp: SurfRec *sr = new SurfRec(); FDM/YASim/Wing.cpp: sr = new SurfRec(); FDM/YASim/Wing.cpp: Surface* s = new Surface(); FDM/YASim/YASim.cxx: _fdm = new FGFDM(); FDM/YASim/YASim.cxx: _fdm->getAirplane()->getModel()->setGroundCallback( new FGGround(this) ); FDM/YASim/yasim-test.cpp: FGFDM* fdm = new FGFDM(); GUI/AirportList.cxx: char **content = new char *[num_apt + 1]; GUI/AirportList.cxx: content[n] = new char[entry.size() + 1]; GUI/dialog.cxx: obj = new puDialogBox(x, y); GUI/dialog.cxx: obj = new fgPopup(x, y, draggable); GUI/dialog.cxx: puGroup * obj = new puGroup(x, y); GUI/dialog.cxx: puGroup * obj = new puGroup(x, y); GUI/dialog.cxx: puFrame * obj = new puFrame(x, y, x + width, y + height); ... GUI/gui_funcs.cxx: char *filename = new char [24]; GUI/gui_funcs.cxx: b1 = new GlBitmap( GL_RGB, 1, 1, (unsigned char *)"123" ); GUI/gui_funcs.cxx: char *filename = new char [24]; GUI/gui_funcs.cxx: char *filename = new char [24]; GUI/gui_funcs.cxx: char *filename = new char [24]; GUI/layout.cxx: TabCell* children = new TabCell[nc]; GUI/layout.cxx: int* rowSizes = new int[rows]; GUI/layout.cxx: int* colSizes = new int[cols]; GUI/layout.cxx: int* rowY = new int[rows]; GUI/layout.cxx: int* colX = new int[cols]; GUI/menubar.cxx: _bindings[items[j]].push_back(new SGBinding(binding, globals->get_props())); GUI/menubar.cxx: _menuBar = new puMenuBar; GUI/menubar.cxx: node->getNode("enabled")->addChangeListener(new EnabledListener()); GUI/menubar.cxx: char ** list = new char*[size+1]; GUI/menubar.cxx: puCallback * list = new puCallback[size+1]; GUI/new_gui.cxx: : _menubar(new FGMenuBar), GUI/new_gui.cxx: _menubar = new FGMenuBar; GUI/new_gui.cxx: _active_dialogs[name] = new FGDialog(_dialog_props[name]); GUI/new_gui.cxx: SGPropertyNode * props = new SGPropertyNode; GUI/new_gui.cxx: _colors["background"] = new FGColor(0.8f, 0.8f, 0.9f, 0.85f); ... GUI/property_list.cxx: _entries = new char*[_num_entries + 1]; GUI/property_list.cxx: _entries = new char*[_num_entries + 1]; GUI/property_list.cxx: _entries[0] = new char[2]; GUI/property_list.cxx: _entries[1] = new char[3]; GUI/property_list.cxx: _children = new NodeData[_num_children]; ... GUI/puList.cxx: _frame = new puFrame(0, 0, w, h); GUI/puList.cxx: _list_box = new puListBox(0, 0, w-_sw, h); GUI/puList.cxx: _slider = new puSlider(w-_sw, _sw, h-2*_sw, true, _sw); GUI/puList.cxx: _down_arrow = new puArrowButton(w-_sw, 0, w, _sw, PUARROW_DOWN) ; GUI/puList.cxx: _up_arrow = new puArrowButton(w-_sw, h-_sw, w, h, PUARROW_UP); GUI/sgVec3Slider.cxx: HS0 = new FloatDial ( dialer_x, dialer_y, dialer_size, vec[0], Xtitle, 180.0f, -180.0f ); GUI/sgVec3Slider.cxx: HS1 = new FloatDial ( dialer_x, dialer_y, dialer_size, vec[1], Ytitle, 89.99f, -89.99f ); GUI/sgVec3Slider.cxx: HS2 = new FloatSlider ( slider_x+20, slider_y, slider_width-40, vec[2], Ztitle, 100.0f, 0.0f ); GUI/sgVec3Slider.cxx: right_arrow = new puArrowButton ( slider_x + slider_width - 20, slider_y + 1, slider_x + slider_width, slider_y+21, PUARROW_RIGHT ) ; GUI/sgVec3Slider.cxx: left_arrow = new puArrowButton ( slider_x, slider_y + 1, slider_x+20, slider_y+21, PUARROW_LEFT ) ; ... Input/fgjs.cxx: jsSuper *jss = new jsSuper(); Input/fgjs.cxx: jsInput *jsi = new jsInput(jss); Input/fgjs.cxx: fstream *xfs = new fstream[ jss->getNumJoysticks() ]; Input/fgjs.cxx: SGPropertyNode_ptr *jstree = new SGPropertyNode_ptr[ jss->getNumJoysticks() ]; Input/fgjs.cxx: jstree[ jss->getCurrentJoystickId() ] = new SGPropertyNode(); ... Input/input.cxx: jsJoystick * js = new jsJoystick(i); Input/input.cxx: _joystick_bindings[i].axes = new axis[naxes]; Input/input.cxx: _joystick_bindings[i].buttons = new button[nbuttons]; Input/input.cxx: m.modes = new mouse_mode[m.nModes]; Input/input.cxx: m.modes[j].buttons = new button[MAX_MOUSE_BUTTONS]; ... Input/js_demo.cxx: js[i] = new jsJoystick ( i ) ; Input/js_demo.cxx: ax[i] = new float [ js[i]->getNumAxes () ] ; Input/jssuper.cxx: js[i] = new jsJoystick( i ); Instrumentation/dclgps.cxx: _time = new SGTime; Instrumentation/dclgps.cxx: _approachFP = new GPSFlightPlan; Instrumentation/dclgps.cxx: GPSWaypoint* w = new GPSWaypoint; Instrumentation/dclgps.cxx: GPSWaypoint* w = new GPSWaypoint; Instrumentation/dclgps.cxx: GPSWaypoint* w = new GPSWaypoint; ... Instrumentation/gps.cxx: route = new SGRoute; Instrumentation/groundradar.cxx: osg::Vec4Array* colors = new osg::Vec4Array; Instrumentation/groundradar.cxx: _geom = new osg::Geometry(); Instrumentation/groundradar.cxx: _geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, 0)); Instrumentation/groundradar.cxx: _geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, 0)); Instrumentation/groundradar.cxx: osg::Geode* geode = new osg::Geode(); ... Instrumentation/HUD/HUD.cxx: _font_renderer(new fntRenderer()), Instrumentation/HUD/HUD.cxx: item = static_cast<Item *>(new Label(this, n, x, y)); Instrumentation/HUD/HUD.cxx: item = static_cast<Item *>(new Gauge(this, n, x, y)); Instrumentation/HUD/HUD.cxx: item = static_cast<Item *>(new Tape(this, n, x, y)); Instrumentation/HUD/HUD.cxx: item = static_cast<Item *>(new Dial(this, n, x, y)); ... Instrumentation/instrument_mgr.cxx: config_props = new SGPropertyNode; Instrumentation/inst_vertical_speed_indicator.cxx: _pressure_table(new SGInterpTable), Instrumentation/inst_vertical_speed_indicator.cxx: _altitude_table(new SGInterpTable) Instrumentation/KLN89/kln89.cxx: GPSPage* apt_page = new KLN89AptPage(this); Instrumentation/KLN89/kln89.cxx: GPSPage* vor_page = new KLN89VorPage(this); Instrumentation/KLN89/kln89.cxx: GPSPage* ndb_page = new KLN89NDBPage(this); Instrumentation/KLN89/kln89.cxx: GPSPage* int_page = new KLN89IntPage(this); Instrumentation/KLN89/kln89.cxx: GPSPage* usr_page = new KLN89UsrPage(this); ... Instrumentation/KLN89/kln89_page_act.cxx: _aptPage = new KLN89AptPage(parent); Instrumentation/KLN89/kln89_page_act.cxx: _vorPage = new KLN89VorPage(parent); Instrumentation/KLN89/kln89_page_act.cxx: _ndbPage = new KLN89NDBPage(parent); Instrumentation/KLN89/kln89_page_act.cxx: _intPage = new KLN89IntPage(parent); Instrumentation/KLN89/kln89_page_act.cxx: _usrPage = new KLN89UsrPage(parent); Instrumentation/KLN89/kln89_page_apt.cxx: GPSWaypoint* wp = new GPSWaypoint; Instrumentation/KLN89/kln89_page_apt.cxx: wp = new GPSWaypoint; Instrumentation/KLN89/kln89_page_apt.cxx: wp = new GPSWaypoint; Instrumentation/KLN89/kln89_page_fpl.cxx: GPSWaypoint* wp = new GPSWaypoint; Instrumentation/KLN89/kln89_page_fpl.cxx: GPSWaypoint* wp = new GPSWaypoint; Instrumentation/KLN89/kln89_page_fpl.cxx: GPSWaypoint* wp = new GPSWaypoint; Instrumentation/KLN89/kln89_page_fpl.cxx: _entWp = new GPSWaypoint; Instrumentation/KLN89/kln89_page_fpl.cxx: _entWp = new GPSWaypoint; Instrumentation/marker_beacon.cxx: term_tbl = new SGInterpTable( term.str() ); Instrumentation/marker_beacon.cxx: low_tbl = new SGInterpTable( low.str() ); Instrumentation/marker_beacon.cxx: high_tbl = new SGInterpTable( high.str() ); Instrumentation/mk_viii.cxx: sample = new SGSoundSample(sample_path.c_str(), filename.c_str()); Instrumentation/mk_viii.hxx: inline void append (Voice *voice, const char *sample_name) { voice->append(new Voice::SampleElement(get_sample(sample_name))); } Instrumentation/mk_viii.hxx: inline void append (Voice *voice, double silence) { voice->append(new Voice::SilenceElement(silence)); } Instrumentation/mk_viii.hxx: inline void make_voice (Voice **voice) { *voice = new Voice(this); _voices.push_back(*voice); } Instrumentation/navradio.cxx: term_tbl = new SGInterpTable( term.str() ); Instrumentation/navradio.cxx: low_tbl = new SGInterpTable( low.str() ); Instrumentation/navradio.cxx: high_tbl = new SGInterpTable( high.str() ); Instrumentation/od_gauge.cxx: camera = new osg::Camera; Instrumentation/od_gauge.cxx: stateSet->setAttributeAndModes(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, Instrumentation/od_gauge.cxx: stateSet->setAttributeAndModes(new osg::AlphaFunc(osg::AlphaFunc::GREATER, Instrumentation/od_gauge.cxx: stateSet->setAttribute(new osg::ShadeModel(osg::ShadeModel::FLAT)); Instrumentation/od_gauge.cxx: stateSet->setAttributeAndModes(new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, ... Instrumentation/wxradar.cxx: _radarGeode = new osg::Geode; Instrumentation/wxradar.cxx: _geom = new osg::Geometry; Instrumentation/wxradar.cxx: _vertices = new osg::Vec2Array; Instrumentation/wxradar.cxx: _texCoords = new osg::Vec2Array; Instrumentation/wxradar.cxx: osg::Vec3Array* colors = new osg::Vec3Array; ... Main/fg_commands.cxx: * @param filename a string to hold the complete path & filename of the (new) Main/fg_init.cxx: ->addChangeListener( new FGTowerLocationListener(), true ); Main/fg_init.cxx: FGAirportList *airports = new FGAirportList(); Main/fg_init.cxx: FGRunwayList *runways = new FGRunwayList(); Main/fg_init.cxx: FGNavList *navlist = new FGNavList; Main/fg_init.cxx: FGNavList *loclist = new FGNavList; ... Main/fg_io.cxx: FGATCMain *atcsim = new FGATCMain; Main/fg_io.cxx: FGAtlas *atlas = new FGAtlas; Main/fg_io.cxx: FGOpenGC *opengc = new FGOpenGC; Main/fg_io.cxx: FGAV400 *av400 = new FGAV400; Main/fg_io.cxx: FGGarmin *garmin = new FGGarmin; ... Main/fg_os.cxx: viewer = new osgViewer::Viewer; Main/fg_os.cxx: camera->setViewport(new osg::Viewport(0, 0, realw, realh)); Main/fg_os.cxx: osgViewer::StatsHandler* statsHandler = new osgViewer::StatsHandler; Main/fg_os.cxx: viewer->setSceneData(new osg::Group); Main/fg_os_osgviewer.cxx: viewer = new osgViewer::Viewer; Main/fg_os_osgviewer.cxx: traits = new osg::GraphicsContext::Traits; Main/fg_os_osgviewer.cxx: cameraTraits = new osg::GraphicsContext::Traits(*traits); Main/fg_os_osgviewer.cxx: osg::ref_ptr<osg::Camera> camera = new osg::Camera; Main/fg_os_osgviewer.cxx: camera->setViewport(new osg::Viewport(0, 0, cameraTraits->width, cameraTraits->height)); ... Main/fg_os_sdl.cxx: viewer = new osgViewer::Viewer; Main/fg_os_sdl.cxx: camera->setViewport(new osg::Viewport(0, 0, realw, realh)); Main/fg_os_sdl.cxx: osgViewer::StatsHandler* statsHandler = new osgViewer::StatsHandler; Main/fg_os_sdl.cxx: viewer->setSceneData(new osg::Group); Main/globals.cxx: renderer( new FGRenderer ), Main/globals.cxx: subsystem_mgr( new SGSubsystemMgr ), Main/globals.cxx: event_mgr( new SGEventMgr ), Main/globals.cxx: props( new SGPropertyNode ), Main/globals.cxx: io( new FGIO ), ... Main/logger.cxx: log.output = new ofstream(filename.c_str()); Main/main.cxx: globals->set_matlib( new SGMaterialLib ); Main/main.cxx: globals->set_model_lib(new SGModelLib); Main/main.cxx: globals->set_scenery( new FGScenery ); Main/main.cxx: globals->set_tile_mgr( new FGTileMgr ); Main/main.cxx: globals->set_model_mgr(new FGModelMgr); ... Main/metar_main.cxx: SGMetar *m = new SGMetar(argv[i], proxy_host, proxy_port, "", time(0)); Main/options.cxx: waypoints = new string_list; Main/options.cxx: waypoints = new string_list; Main/renderer.cxx: stateSet->setAttribute(new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA)); Main/renderer.cxx: stateSet->setAttribute(new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA)); Main/renderer.cxx:static osg::ref_ptr<osg::FrameStamp> mFrameStamp = new osg::FrameStamp; Main/renderer.cxx:static osg::ref_ptr<SGUpdateVisitor> mUpdateVisitor= new SGUpdateVisitor; Main/renderer.cxx:static osg::ref_ptr<osg::Group> mRealRoot = new osg::Group; ... Main/splash.cxx: osg::RefMatrix* matrix = new osg::RefMatrix; Main/splash.cxx: osg::Texture2D* splashTexture = new osg::Texture2D; Main/splash.cxx: osg::Camera* camera = new osg::Camera; Main/splash.cxx: stateSet->setAttribute(new osg::BlendFunc); Main/splash.cxx: stateSet->setAttribute(new osg::Depth(osg::Depth::ALWAYS, 0, 1, false)); ... Main/viewer.cxx: _location = new SGLocation; Main/viewmgr.cxx: add_view(new FGViewer ( FG_LOOKAT, from_model, from_model_index, Main/viewmgr.cxx: add_view(new FGViewer ( FG_LOOKFROM, from_model, from_model_index, Main/ViewPartitionNode.cxx: Camera* camera = new Camera; Main/ViewPartitionNode.cxx: Depth* depth = new Depth(Depth::LESS, 0.0, 1.0, false); Main/ViewPartitionNode.cxx: StateSet* backgroundSS = new StateSet; Main/ViewPartitionNode.cxx: ref_ptr<RefMatrix> newProj = new RefMatrix(); Model/acmodel.cxx: _selector(new osg::Switch), Model/acmodel.cxx: _aircraft = new SGModelPlacement; Model/modelmgr.cxx: _listener(new Listener(this)) Model/modelmgr.cxx: Instance * instance = new Instance; Model/modelmgr.cxx: SGModelPlacement *model = new SGModelPlacement; Model/model_panel.cxx: osg::Geode* geode = new osg::Geode; Model/model_panel.cxx: geode->addDrawable(new FGPanelNode(n)); Model/panelnode.cxx: osg::ref_ptr<osg::RefMatrix> mv = new osg::RefMatrix; MultiPlayer/multiplaymgr.cxx: mSocket = new netSocket(); MultiPlayer/multiplaymgr.cxx: FGPropertyData* pData = new FGPropertyData; MultiPlayer/multiplaymgr.cxx: pData->string_value = new char[length + 1]; MultiPlayer/multiplaymgr.cxx: pData->string_value = new char[1]; MultiPlayer/multiplaymgr.cxx: char *MsgBuf = new char[MsgHdr->MsgLen - sizeof(T_MsgHdr)]; ... Navaids/awynet.cxx: n = new FGNode(latStart, lonStart, startIndex, identStart); Navaids/awynet.cxx: n = new FGNode(latEnd, lonEnd, endIndex, identEnd); Navaids/navdb.cxx: FGNavRecord *r = new FGNavRecord; Navaids/navdb.cxx: FGNavRecord *r = new FGNavRecord; Navaids/navdb.cxx: FGTACANRecord *r = new FGTACANRecord; Navaids/testnavs.cxx: FGNavList *current_navlist = new FGNavList; Navaids/testnavs.cxx: FGMarkerBeacons *current_beacons = new FGMarkerBeacons; Navaids/testnavs.cxx: FGILSList *current_ilslist = new FGILSList; Navaids/testnavs.cxx: FGFixList *current_fixlist = new FGFixList; Network/ATC-Main.cxx: input0 = new FGATCInput( 0, input0_path ); Network/ATC-Main.cxx: input1 = new FGATCInput( 1, input1_path ); Network/ATC-Main.cxx: output0 = new FGATCOutput( 0, output0_path ); Network/ATC-Main.cxx: output1 = new FGATCOutput( 1, output1_path ); Network/httpd.cxx: server = new HttpdServer( port ); Network/httpd.hxx: HttpdChannel *hc = new HttpdChannel; Network/jpg-httpd.cxx: imageServer = new HttpdImageServer( port ); Network/jpg-httpd.hxx: JpgFactory = new trJpgFactory(); Network/jpg-httpd.hxx: HttpdImageChannel *hc = new HttpdImageChannel; Network/multiplay.cxx: FGPropertyData* pData = new FGPropertyData; Network/multiplay.cxx: pData->string_value = new char[len + 1]; Network/props.cxx: PropsChannel* channel = new PropsChannel(); Scenery/redout.cxx: osg::Geometry* geometry = new osg::Geometry; Scenery/redout.cxx: stateSet->setAttribute(new osg::BlendFunc); Scenery/redout.cxx: stateSet->setAttribute(new osg::Depth(osg::Depth::ALWAYS, 0, 1, false)); Scenery/redout.cxx: osg::Vec3Array* vertexArray = new osg::Vec3Array; Scenery/redout.cxx: osg::Vec4Array* colorArray = new osg::Vec4Array; ... Scenery/scenery.cxx: scene_graph = new osg::Group; Scenery/scenery.cxx: terrain_branch = new osg::Group; Scenery/scenery.cxx: userData->setPickCallback(new FGGroundPickCallback); Scenery/scenery.cxx: models_branch = new osg::Group; Scenery/scenery.cxx: aircraft_branch = new osg::Group; ... Scenery/tileentry.cxx: _node( new osg::LOD ), Scenery/tileentry.cxx: _node->setUpdateCallback(new FGTileUpdateCallback); Scenery/tileentry.cxx: _node->setCullCallback(new TileCullCallback); Scenery/tileentry.cxx: = new SGReaderWriterBTGOptions(); Scenery/tileentry.cxx: objects.push_back(new Object(OBJECT, token, tile_path, in)); ... Scenery/tilemgr.cxx: FGTileEntry *e = new FGTileEntry( b ); Scripting/nasal-props.cxx: SGPropertyNode_ptr* ghost = new SGPropertyNode_ptr(n); Scripting/NasalSys.cxx: char* buf = new char[data.st_size]; Scripting/NasalSys.cxx: FGNasalScript* script = new FGNasalScript(); Scripting/NasalSys.cxx: tmp = new SGPropertyNode(); Scripting/NasalSys.cxx: double* values = new double[nPoints]; Scripting/NasalSys.cxx: double* deltas = new double[nPoints]; ... Sound/beacon.cxx: inner = new SGSoundSample( inner_buf, INNER_SIZE, BYTES_PER_SECOND ); Sound/beacon.cxx: middle = new SGSoundSample( middle_buf, MIDDLE_SIZE, BYTES_PER_SECOND ); Sound/beacon.cxx: outer = new SGSoundSample( outer_buf, OUTER_SIZE, BYTES_PER_SECOND); Sound/fg_fx.cxx: SGXmlSound *sound = new SGXmlSound(); Sound/fg_fx.cxx: sample = new SGSoundSample( path.c_str(), fname.c_str() ); Sound/morse.cxx: unsigned char *buffer = new unsigned char[length]; Sound/morse.cxx: SGSoundSample *sample = new SGSoundSample( buffer, length, Sound/voice.cxx: _thread = new FGVoiceThread(this); Sound/voice.cxx: _voices.push_back(new FGVoice(this, voices[i])); Sound/voice.cxx: _sock = new SGSocket(host, port, "tcp"); Sound/voice.cxx: node->getNode("text", true)->addChangeListener(new FGVoiceListener(this)); Systems/electrical.cxx: config_props = new SGPropertyNode; Systems/system_mgr.cxx: config_props = new SGPropertyNode; Time/light.cxx: _ambient_tbl = new SGInterpTable( ambient_path.str() ); Time/light.cxx: _diffuse_tbl = new SGInterpTable( diffuse_path.str() ); Time/light.cxx: _specular_tbl = new SGInterpTable( specular_path.str() ); Time/light.cxx: _sky_tbl = new SGInterpTable( sky_path.str() ); Traffic/Schedule.cxx: flights.push_back(new FGScheduledFlight((*(*i)))); Traffic/Schedule.cxx: FGAIAircraft *aircraft = new FGAIAircraft(this); Traffic/Schedule.cxx: aircraft->SetFlightPlan(new FGAIFlightPlan(flightPlanName, courseToDest, deptime, Traffic/TrafficMgr.cxx: flights.push_back(new FGScheduledFlight(callsign, Traffic/TrafficMgr.cxx: scheduledAircraft.push_back(new FGAISchedule(mdl, ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel