Free cookie consent management tool by TermsFeed Policy Generator

Opened 14 years ago

Closed 14 years ago

#1268 closed defect (done)

A severe memory leak exists when executing an algorithm multiple times

Reported by: svonolfe Owned by: swagner
Priority: highest Milestone: HeuristicLab 3.3.2
Component: General Version: 3.3.2
Keywords: Cc: abeham, mkommend

Description (last modified by svonolfe)

When executing an algorithm multiple times, the memory consumption skyrockets. To illustrate this phenomena, try the attached test project which executes the GA_VRP algorithm multiple times (using 10 iterations).

I was able to trace back the problem to the Run::Initialize method using the CLR profiler and created a patch for that method. The test project contains the patched dll.

Please note if you enable algorithm.StoreAlgorithmInEachRun you can see the memory leak. After applying the patch, if you disable algorithm.StoreAlgorithmInEachRun the memory leak seems to disappear, or at least becomes less severe.

The problem seems to be related to the recent cloning refactoring.

Attachments (2)

MemoryLeak.patch (1.1 KB) - added by svonolfe 14 years ago.
MemoryLeakTest.zip (1.5 MB) - added by svonolfe 14 years ago.

Download all attachments as: .zip

Change History (21)

Changed 14 years ago by svonolfe

Changed 14 years ago by svonolfe

comment:1 Changed 14 years ago by svonolfe

  • Description modified (diff)

comment:2 Changed 14 years ago by swagner

  • Status changed from new to accepted

comment:3 Changed 14 years ago by swagner

  • Cc gkronber removed
  • Milestone changed from HeuristicLab x.x.x to HeuristicLab 3.3.2
  • Version changed from 3.3 to 3.3.1

comment:4 Changed 14 years ago by swagner

  • Component changed from ### Undefined ### to General

Worked on in r4825.

comment:5 Changed 14 years ago by swagner

  • Owner changed from swagner to mkommend
  • Status changed from accepted to reviewing

comment:6 Changed 14 years ago by mkommend

Tested the implemented changes in the CLR profiler and the memory consumption dropped dramatically.

comment:7 follow-up: Changed 14 years ago by mkommend

The memory leak regarding the parameters is fixed as far is I can see in the CLR profiler. Although a memory leak still exists while collecting the result values, but I could not exactly track down what causes this memory leak.

I still have to code review the changes made in r4825 and every problem / algorithm that does no full deep clone must be corrected.

comment:8 Changed 14 years ago by abeham

To the best of my knowledge, algorithms, at least the ones I implemented, perform a full deep clone.

I remember from the cloning refactoring, that the VRP problem does not fully deep clone.

comment:9 Changed 14 years ago by mkommend

Corrected cloning of results and parameters in Run with r4833.

comment:10 in reply to: ↑ 7 Changed 14 years ago by mkommend

Replying to mkommend:

Although a memory leak still exists while collecting the result values, but I could not exactly track down what causes this memory leak.

This memory leak has the same cause as the first one. Results get collected and the ResultsCollection registers on ToStringChanged and ItemImageChanged. If a result is the same as a parameter of the problem or the algorithm (e.g. BestKnownQuality) the whole ResultCollection can't be released and collected by the GC. A resolution to this problem would be if all collected values get cloned before they are collected (ticket #1279).

comment:11 Changed 14 years ago by mkommend

  • Status changed from reviewing to assigned

comment:12 Changed 14 years ago by mkommend

  • Status changed from assigned to accepted

comment:13 Changed 14 years ago by mkommend

Corrected memory leak in Problems.DataAnalysis with r4834.

Version 0, edited 14 years ago by mkommend (next)

comment:14 Changed 14 years ago by mkommend

  • Owner changed from mkommend to swagner
  • Status changed from accepted to reviewing

Reviewed and tested the changes from r4825.

comment:15 Changed 14 years ago by swagner

  • Owner changed from swagner to svonolfe
  • Status changed from reviewing to assigned

According to the changes described in this ticket, please adapt the VRP, if it contains any parameters which are not deeply cloned.

comment:16 Changed 14 years ago by svonolfe

  • Owner changed from svonolfe to mkommend

comment:17 Changed 14 years ago by swagner

  • Owner changed from mkommend to swagner
  • Status changed from assigned to accepted

comment:18 Changed 14 years ago by swagner

  • Status changed from accepted to readytorelease

comment:19 Changed 14 years ago by swagner

  • Resolution set to done
  • Status changed from readytorelease to closed
  • Version changed from 3.3.1 to 3.3.2
Note: See TracTickets for help on using tickets.