Changeset 69682a


Ignore:
Timestamp:
Mar 8, 2017, 9:46:36 PM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_ChronosMutex, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
ba1152
Parents:
494d1f
git-author:
Frederik Heber <heber@…> (03/06/17 13:50:46)
git-committer:
Frederik Heber <heber@…> (03/08/17 21:46:36)
Message:

LinearAlgebra's static Vectors are now ignore Memory::ignore()'d there.

  • this is necessary as although zeroVec and unitVec are static, the contained VectorContent is not (but heap-allocated) and hence fails the MemDebug check. We fixed this so far inside molecuilder via cleanUp(), however this fails now with molecuilder_mpqc. Now we use static functions that internally contain a unique VectorContent* that is Memory::ignore()'d.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ThirdParty/LinearAlgebra/src/LinearAlgebra/Vector.cpp

    r494d1f r69682a  
    634634}
    635635
    636 
    637 // some comonly used vectors
    638 const Vector zeroVec(0,0,0);
    639 const Vector unitVec[NDIM]={Vector(1,0,0),Vector(0,1,0),Vector(0,0,1)};
     636static VectorContent *& setUnitVectorContent(VectorContent *&_content, const size_t _axis)
     637{
     638  _content->at(_axis) = 1.;
     639  return _content;
     640}
     641
     642// some commonly used vectors
     643VectorContent *VCs[4] = {
     644    Memory::ignore(new VectorContent((size_t) NDIM)),
     645    Memory::ignore(new VectorContent((size_t) NDIM)),
     646    Memory::ignore(new VectorContent((size_t) NDIM)),
     647    Memory::ignore(new VectorContent((size_t) NDIM))
     648};
     649
     650const Vector zeroVec(VCs[0]);
     651const Vector unitVec[NDIM]={
     652    Vector(setUnitVectorContent(VCs[1],0)),
     653    Vector(setUnitVectorContent(VCs[2],1)),
     654    Vector(setUnitVectorContent(VCs[3],2))
     655};
  • src/cleanUp.cpp

    r494d1f r69682a  
    8484void AddStaticEntitiestoIgnoreList()
    8585{
    86   // zeroVec and unitVec are global variables (on the stack) but vectorContent
    87   // within is situated on the heap and has to be ignored
    88   Memory::ignore(zeroVec.get());
    89   Memory::ignore(unitVec[0].get());
    90   Memory::ignore(unitVec[1].get());
    91   Memory::ignore(unitVec[2].get());
    92 
    9386  // XmlParser has static instance that uses vectorContent as well
    9487  Memory::ignore(FormatParser< xml >::defaultAtomInfo.field.get());
Note: See TracChangeset for help on using the changeset viewer.