Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak and unresponsive app when using bind and key block on same variable #9172

Closed
sriramk1n1 opened this issue Sep 2, 2023 · 1 comment

Comments

@sriramk1n1
Copy link

Describe the bug

Is this expected behaviour? There is no reason to use bind within key block like this, I accidentally used it, this leads to app being completely unresponsive and memory completely fills within minutes.

Reproduction

app.svelte:

<script>
  import Comp from "./component.svelte"
  let arr=Array(10).fill(0);
</script>

{#key arr}
    <Comp bind:arr />
{/key}

component.svelte:

<script>
    export let arr;
<script>
{arr.length}

Logs

No response

System Info

Binaries:
    Node: 20.5.1 - /usr/bin/node
    npm: 9.8.1 - /usr/bin/npm
  Browsers:
    Chromium: 115.0.5790.102
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0 
    @sveltejs/kit: ^1.20.4 => 1.24.0 
    svelte: ^4.0.5 => 4.2.0 
    vite: ^4.4.2 => 4.4.9

Severity

annoyance

Additional Information

No response

@gtm-nayan gtm-nayan transferred this issue from sveltejs/kit Sep 2, 2023
@Prinzhorn
Copy link
Contributor

There is no reason to use bind within key block like this

Then don't 😄

It's essentially creating some sort of infinite reactive loop, the underlying bug likely being #5689 because otherwise there is no reason for arr to be invalidated in this scenario.

@sriramk1n1 sriramk1n1 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants