Changeset b65901 for src/boundary.cpp


Ignore:
Timestamp:
Jul 9, 2009, 11:40:14 AM (15 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
8cede7
Parents:
e72001
Message:

Fixed all of the remaining memory leaks due to CandidatesForTesselation list.

  • Opt_Candidates list in Find_next_suitable_triangle() and Find_starting_triangle() was not deleted
  • Also, all contained CandidatesForTesselation were not deleted
  • the candidates list was cleared in Find_third_point_for_Tesselation() but the contained CandidatesForTesselation were not deleted
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    re72001 rb65901  
    249249CandidateForTesselation::~CandidateForTesselation() {
    250250        point = NULL;
     251        BaseLine = NULL;
    251252}
    252253
     
    19121913  int N[NDIM], Nlower[NDIM], Nupper[NDIM];
    19131914  atom *Candidate = NULL;
    1914   CandidateForTesselation *optCandidate;
     1915  CandidateForTesselation *optCandidate = NULL;
    19151916
    19161917  cout << Verbose(1) << "Begin of Find_third_point_for_Tesselation" << endl;
     
    20212022                            << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;
    20222023                        } else {
     2024                          // remove all candidates from the list and then the list itself
     2025                          class CandidateForTesselation *remover = NULL;
     2026                          for (CandidateList::iterator it = candidates->begin(); it != candidates->end(); ++it) {
     2027                            remover = *it;
     2028                            delete(remover);
     2029                          }
    20232030                          candidates->clear();
    20242031                          candidates->push_back(optCandidate);
     
    24082415  );
    24092416  cout << Verbose(1) << "Third Points are ";
    2410   CandidateList::iterator it;
    2411   for (it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
     2417  for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
    24122418      cout << " " << *(*it)->point;
    24132419  }
    24142420  cout << endl;
    24152421
    2416   for (it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
     2422  for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
    24172423          // add third triangle point
    24182424          AddTrianglePoint((*it)->point, 2);
     
    24402446          }
    24412447  }
     2448  // remove all candidates from the list and then the list itself
     2449  class CandidateForTesselation *remover = NULL;
     2450  for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
     2451    remover = *it;
     2452    delete(remover);
     2453  }
     2454  delete(Opt_Candidates);
    24422455  cout << Verbose(2) << "Projection is " << BTS->NormalVector.Projection(&Oben) << "." << endl;
    24432456  cout << Verbose(1) << "End of Find_starting_triangle\n";
     
    25722585  }
    25732586  cout << Verbose(1) << "Third Points are ";
    2574   CandidateList::iterator it;
    2575   for (it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
     2587  for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
    25762588          cout << " " << *(*it)->point;
    25772589  }
     
    25792591
    25802592  BoundaryLineSet *BaseRay = &Line;
    2581   for (it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
     2593  for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
    25822594          cout << Verbose(1) << " Third point candidate is " << *(*it)->point
    25832595                << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
     
    27012713    // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point))
    27022714          BaseRay = BLS[0];
    2703 //    LineMap::iterator LineIterator = Line.endpoints[0]->lines.find((*it)->point->nr);
    2704 //    for (; LineIterator != Line.endpoints[0]->lines.end(); LineIterator++) {
    2705 //      if ((*LineIterator->second).TrianglesCount != 2)
    2706 //        break;
    2707 //    }
    2708 //    if (LineIterator == Line.endpoints[0]->lines.end())
    2709 //      cout << Verbose(1) << "ERROR: I could not find a suitable line with less than two triangles connected!" << endl;
    2710   }
    2711 
     2715  }
     2716
     2717  // remove all candidates from the list and then the list itself
     2718  class CandidateForTesselation *remover = NULL;
     2719  for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) {
     2720    remover = *it;
     2721    delete(remover);
     2722  }
     2723  delete(Opt_Candidates);
    27122724  cout << Verbose(1) << "End of Find_next_suitable_triangle\n";
    27132725  return result;
Note: See TracChangeset for help on using the changeset viewer.