Skip to content

Commit c1f896b

Browse files
author
Mikael Zayenz Lagerkvist
committed
Dispose random view selectors
1 parent f7bd1fe commit c1f896b

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

changelog.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ This release modernizes the Gecode build infrastructure, adds a
7575
first-class CMake package for downstream consumers, refreshes the
7676
autoconf build path, and updates CI coverage for current platforms.
7777

78+
[ENTRY]
79+
Module: kernel
80+
What: bug
81+
Rank: minor
82+
Issue: 62
83+
Thanks: k0stjap
84+
[DESCRIPTION]
85+
Dispose the random view selector used by random variable branching so
86+
its random generator handle is released when the brancher is discarded.
87+
7888
[ENTRY]
7989
Module: float
8090
What: bug

gecode/kernel/branch/view-sel.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ namespace Gecode {
182182
//@{
183183
/// Create copy during cloning
184184
virtual ViewSel<View>* copy(Space& home);
185+
/// Whether dispose must always be called (that is, notice is needed)
186+
virtual bool notice(void) const;
187+
/// Delete view selection
188+
virtual void dispose(Space& home);
185189
//@}
186190
};
187191

@@ -539,6 +543,16 @@ namespace Gecode {
539543
ViewSelRnd<View>::copy(Space& home) {
540544
return new (home) ViewSelRnd<View>(home,*this);
541545
}
546+
template<class View>
547+
forceinline bool
548+
ViewSelRnd<View>::notice(void) const {
549+
return true;
550+
}
551+
template<class View>
552+
forceinline void
553+
ViewSelRnd<View>::dispose(Space&) {
554+
r.~Rnd();
555+
}
542556

543557

544558
template<class Val>

0 commit comments

Comments
 (0)