Ticket #10014 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Reduce valgrind errors in setOrientedLattice usage

Reported by: Andrei Savici Owned by: Andrei Savici
Priority: major Milestone: Release 3.3
Component: Framework Keywords:
Cc: Blocked By:
Blocking: Tester: Wenduo Zhou

Description (last modified by Andrei Savici) (diff)

There are many memory leaks like

ws->mutableSample().setOrientedLattice(new OrientedLattice(o));

setOrientedLattice should copy the OrientedLattice, not use a pointer

Change History

comment:1 Changed 6 years ago by Andrei Savici

  • Status changed from new to assigned

comment:2 Changed 6 years ago by Andrei Savici

  • Description modified (diff)

comment:3 Changed 6 years ago by Andrei Savici

  • Status changed from assigned to inprogress

Fix usage of setOrientedLattice. Refs #10014

Changeset: 475d6eb41eabee960c1accadc41ece24d79a80c5

comment:4 Changed 6 years ago by Andrei Savici

Fix failing test. Refs #10014

In SampleTest, there was a check if the address of the OrientedLattice object used to set the OrientedLattice on the sample is the same as the one pointed by the sample. That is no longer the case. setOrientedLattice now makes a copy (to reduce memory leaks)

Changeset: 57aaa178c9002eae9668457d62c6a2101099b7a0

comment:5 Changed 6 years ago by Martyn Gigg

The valgrind job has picked up a memory leak in SampleTest:

http://builds.mantidproject.org/view/Static%20Analysis/job/valgrind_develop_core_packages/110/valgrindResult/pid=20776,0x743/

I think it is just that latt now needs to be explicitly deleted in each test in SampleTest.h

Last edited 6 years ago by Martyn Gigg (previous) (diff)

comment:6 Changed 6 years ago by Andrei Savici

Delete a few pointers. Refs #10014

Changeset: ad15d6323faf6a1834bdfd7430559bb8d76a1f38

comment:7 Changed 6 years ago by Andrei Savici

A few more pointers to delete. Refs #10014

Changeset: 41813778f041c08002851290b6cf1293639606ec

comment:8 Changed 6 years ago by Andrei Savici

Try to fix some invalid reads. Refs #10014

Changeset: 82250b826f07317dd2ebdbe4c39f70d2186049f8

comment:9 Changed 6 years ago by Andrei Savici

  • Status changed from inprogress to verify
  • Resolution set to fixed

To tester: unit tests (system tests) should pass. Valgrind crystal had 297kB leaked in 121 errors (build 18 http://builds.mantidproject.org/view/Valgrind/job/valgrind_develop_crystal/18/valgrindResult/), now it's 48 Kb leaked, and only 98 errors (build 21 http://builds.mantidproject.org/view/Valgrind/job/valgrind_develop_crystal/21/valgrindResult/)

comment:10 Changed 6 years ago by Wenduo Zhou

  • Status changed from verify to verifying
  • Tester set to Wenduo Zhou

comment:11 Changed 6 years ago by Wenduo Zhou

All tests are passed. Ticket is closed as there is no error reported from valgrind.

comment:12 Changed 6 years ago by Wenduo Zhou

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/10014_setOrientedLatticePointer'

Full changeset: 9ee68fcbd138e4ba40dd3b748c35ca0a5d9584d0

comment:13 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10856

Note: See TracTickets for help on using tickets.