Changeset c1d78c for src


Ignore:
Timestamp:
Jul 10, 2012, 2:09:43 PM (12 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:
004d5c
Parents:
edecba
git-author:
Frederik Heber <heber@…> (07/10/12 12:59:42)
git-committer:
Frederik Heber <heber@…> (07/10/12 14:09:43)
Message:

FIX: Tesselation_BoundaryTriangleUnitTest did not properly removed temporary TesselPoints.

  • although we did remove them correctly in teardown(), in intermediate removals in functions we did so only via "delete triangle". This kept the TesselPoints especially in the static Observable map which causes memory corruption on program exit.
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Atom/atom_observable.cpp

    redecba rc1d78c  
    4040{
    4141  std::map<Observable *, Channels*>::iterator iter = NotificationChannels.find(this);
     42  ASSERT(iter != NotificationChannels.end(),
     43      "~AtomObservable() - cannot find myself in NotificationChannels.");
    4244  delete iter->second;
    4345  NotificationChannels.erase(iter);
  • src/Tesselation/unittests/Tesselation_BoundaryTriangleUnitTest.cpp

    redecba rc1d78c  
    5454void TesselationBoundaryTriangleTest::createTriangle(const std::vector<Vector> &Vectors)
    5555{
    56   CPPUNIT_ASSERT_EQUAL( (size_t)3, Vectors.size() );
     56  CPPUNIT_ASSERT_EQUAL( (size_t)NDIM, Vectors.size() );
    5757
    5858  // create nodes
     
    7676}
    7777
     78/** This cleanly removes a triangle created via createTriangle() from memory.
     79 *
     80 */
     81void TesselationBoundaryTriangleTest::removeTriangle()
     82{
     83  delete(triangle);
     84  for (int i=0;i<NDIM;++i) {
     85    // TesselPoint does not delete its vector as it only got a reference
     86    delete tesselpoints[i];
     87  }
     88}
     89
    7890void TesselationBoundaryTriangleTest::setUp()
    7991{
     
    92104void TesselationBoundaryTriangleTest::tearDown()
    93105{
    94   delete(triangle);
    95   for (int i=0;i<3;++i) {
    96     // TesselPoint does not delete its vector as it only got a reference
    97     delete tesselpoints[i];
    98   }
     106  removeTriangle();
    99107  logger::purgeInstance();
    100108  errorLogger::purgeInstance();
     
    187195{
    188196  {
    189     delete triangle;
     197    removeTriangle();
    190198    // test is from --create-micelle 200 --radius 30. --position "0,0,0" of sles.data
    191199    // failure is: Intersection (23.1644,24.1867,65.1272) is not inside triangle [659|Na2451,O3652,Na3762].
     
    200208  }
    201209  {
    202     delete triangle;
     210    removeTriangle();
    203211    // test is from --create-micelle 200 --radius 30. --position "0,0,0" of sles.data
    204212    // failure is: Intersection (20.6787,70.655,71.5657) is not inside triangle [622|Na1197,Na2166,O3366].
     
    214222  }
    215223  {
    216     delete triangle;
     224    removeTriangle();
    217225    // test is from --create-micelle 200 --radius 30. --position "0,0,0" of sles.data
    218226    // failure is:Intersection (27.56537519896,13.40256646925,6.672946688134) is not inside triangle [702|Na5016,O6388,Na6498].
     
    254262  }
    255263
    256   delete triangle;
     264  removeTriangle();
    257265  // create better triangle;
    258266  VECTORSET(std::vector) Vectors;
     
    289297{
    290298  {
    291     delete triangle;
     299    removeTriangle();
    292300    // test is from --create-micelle 200 --radius 30. --position "0,0,0" of sles.data
    293301    // failure is:Intersection (27.56537519896,13.40256646925,6.672946688134) is not inside triangle [702|Na5016,O6388,Na6498].
  • src/Tesselation/unittests/Tesselation_BoundaryTriangleUnitTest.hpp

    redecba rc1d78c  
    5252private:
    5353      void createTriangle(const std::vector<Vector> &Vectors);
     54      void removeTriangle();
    5455
    5556      static const double SPHERERADIUS;
Note: See TracChangeset for help on using the changeset viewer.