Ticket #8356 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Clear memory leaks in the GeometryTest package

Reported by: Russell Taylor Owned by: Russell Taylor
Priority: major Milestone: Release 3.2
Component: Framework Keywords: Maintenance
Cc: Blocked By:
Blocking: #8360 Tester: Martyn Gigg

Description (last modified by Russell Taylor) (diff)

The SNS Jenkins has a valgrind job which uses the unit tests as a hook into exercising the Mantid code itself. This of course means that it picks up any leaks in the test code as well.

Using this job and/or valgrind runs of your own, eliminate all the leaks/errors that come out of the test code itself. I've created this as an isolated ticket because I'd like to get a clear view of the errors we have in the actual Mantid code. All changes to this ticket should only be to code in the Framework/Geometry/test/ directory!

When working on this, don't just add delete calls - consider whether the leaking call really needs to be a heap allocation; create the object on the stack if not.

Change History

comment:1 Changed 7 years ago by Russell Taylor

  • Blocking 8360 added

comment:2 Changed 7 years ago by Russell Taylor

  • Description modified (diff)

comment:3 Changed 7 years ago by Russell Taylor

  • Owner set to Russell Taylor
  • Milestone changed from Backlog to Release 3.2

comment:4 Changed 7 years ago by Russell Taylor

  • Status changed from new to inprogress

comment:5 Changed 7 years ago by Russell Taylor

Re #8356. Avoid memory leak in test.

By using a shared_array instead of a bare C dynamically-allocated array.

Changeset: b6bc7b877cd7f277d07a9baf0dc26c999a8ae947

comment:6 Changed 7 years ago by Russell Taylor

Re #8356. Fix memory leaks in tests.

By not allocating objects on the heap for no good reason.

Changeset: 9bb8599111276d74d04ac12be73e561cf74d79b8

comment:7 Changed 7 years ago by Russell Taylor

Re #8356. Re #8356. Fix memory leaks in tests.

By calling delete as appropriate on heap allocated objects.

Changeset: 20b3303f899f8381c6ce7adc892361ca70fcf5f6

comment:8 Changed 7 years ago by Russell Taylor

Re #8356. Fix memory leaks in tests.

By a combination of creating objects on the stack instead of the heap and calling delete where still appropriate.

Changeset: ad360dc468d133c491e2c0974e924c32bd819c31

comment:9 Changed 7 years ago by Russell Taylor

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

There are now no memory leaks reported by Valgrind in the Geometry test code itself. Admittedly, this can be hard to see - I can tell because I run it inside Eclipse and get no red X next to the test directory (there's still one next to the src directory, and cleaning that's the task of #8360).

Test by inspection and noting that none of the tests are failing/crashing.

Last edited 7 years ago by Russell Taylor (previous) (diff)

comment:10 Changed 7 years ago by Martyn Gigg

  • Status changed from verify to verifying
  • Tester set to Martyn Gigg

comment:11 Changed 7 years ago by Martyn Gigg

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/bugfix/8356_geometry_test_memory_leaks'

Full changeset: bc367adcc9e386899a33b02550605e21f0780777

comment:12 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9201

Note: See TracTickets for help on using tickets.