Skip to content

Commit

Permalink
BF: memory leak in RatingScale (reduce its severity)
Browse files Browse the repository at this point in the history
- likely due to leak in TextStim, where setText does not release mem for old text
- partial solution = avoid doing setText every frame, use only when needed
  • Loading branch information
jeremygray committed Oct 11, 2015
1 parent 0bebb26 commit a6411f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions psychopy/visual/ratingscale.py
Expand Up @@ -1021,9 +1021,11 @@ def draw(self, log=True):
else:
valTmp = self.markerPlacedAt + self.low
val = self.fmtStr % (valTmp * self.autoRescaleFactor)
self.accept.setText(val)
if self.accept.text != val: # not just for speed: reduce impact of mem leaks in TextStim
self.accept.setText(val)
elif self.markerPlacedAt is not False:
self.accept.setText(self.acceptText)
if self.accept.text != self.acceptText:
self.accept.setText(self.acceptText)

# handle key responses:
if not self.mouseOnly:
Expand Down

0 comments on commit a6411f6

Please sign in to comment.