# Update every frame doesnt work

**URL:** <https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656>\
**Category:** Online experiments\
**Created:** [March 23, 2020, 2:33am UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656 "2020-03-23T02:33:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![compvandy](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@compvandy](https://discourse.psychopy.org/u/compvandy)\
**Post date:** [March 23, 2020, 2:33am UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656/1 "2020-03-23T02:33:40Z")

</div>

URL of experiment: [https://gitlab.pavlovia.org/eeshanhasan/a-test-project](https://gitlab.pavlovia.org/eeshanhasan/a-test-project)

Description of the problem: I wanted to have a drag and drop component in an experiment. This involves me setting the position of the text equal to that of the mouse pointer. I realised that this was creating a memory leak. This is the smallest example that has the error. Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [March 23, 2020, 1:02pm UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656/2 "2020-03-23T13:02:45Z")

</div>

Your repository isn’t public, so we can’t see it. It might be something you’re doing, but it looks like there are a few people having problems with code that updates every frame.

@jon is this a similar root issue to [Pavlovia: black screen and unable to continue (RAM issues)](https://discourse.psychopy.org/t/pavlovia-black-screen-and-unable-to-continue-ram-issues/11645/9)?

---

<div class="post-metadata">

**Author:** ![compvandy](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@compvandy](https://discourse.psychopy.org/u/compvandy)\
**Post date:** [March 23, 2020, 4:35pm UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656/3 "2020-03-23T16:35:36Z")

</div>

I have made it public. Forgot to press ‘save changes’ last time.

---

<div class="post-metadata">

**Author:** ![compvandy](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@compvandy](https://discourse.psychopy.org/u/compvandy)\
**Post date:** [March 23, 2020, 4:38pm UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656/4 "2020-03-23T16:38:25Z")

</div>

It seems to be heaping and creating more nodes for some reason. This memory leak goes pretty quickly.

 ![Screen Shot 2020-03-23 at 11.36.50 AM](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/7/a/7aef474affe294881b1557b3d2be68f428f2cf7b.png)

---

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [March 23, 2020, 6:04pm UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656/5 "2020-03-23T18:04:57Z")

</div>

OK. @jon @apitiot this one is a real issue.

I took your code and modified it further. If you update a property of the textstim object, even with something as simple as textstim.pos = textstim.pos, you get this behavior. The good news is that it’s not the mouse doing it, you can have it call mouse.getPos() and you don’t get this as long as you then don’t try to use that information to set the position of the text stimulus.

So it’s updating the text stimulus on every frame that’s behind this memory leak. Why I’m not sure, but that’s where we’re at.

---

<div class="post-metadata">

**Author:** ![compvandy](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@compvandy](https://discourse.psychopy.org/u/compvandy)\
**Post date:** [March 23, 2020, 8:23pm UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656/6 "2020-03-23T20:23:34Z")

</div>

Thank you. This might be a problem with any of the set functions.

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [March 23, 2020, 8:29pm UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656/7 "2020-03-23T20:29:20Z")

</div>

Thanks for the info on that guys. What browser/OS was this on?

---

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [March 23, 2020, 9:42pm UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656/8 "2020-03-23T21:42:46Z")

</div>

Looks like Chrome for both of us based on the debugger, for OS I’m on MacOS High Sierra.

---

<div class="post-metadata">

**Author:** ![compvandy](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@compvandy](https://discourse.psychopy.org/u/compvandy)\
**Post date:** [March 26, 2020, 6:34pm UTC](https://discourse.psychopy.org/t/update-every-frame-doesnt-work/11656/9 "2020-03-26T18:34:10Z")

</div>

I checked and this problem happens with Firefox as well.

I am on Mojave 10.14.6.

Chrome Version Version 80.0.3987.149 (Official Build) (64-bit)

Firefox 74.0 (64-bit)
