--- title: Auto-subscriptions --- The app in the previous example works, but there's a subtle bug — the store is subscribed to, but never unsubscribed. If the component was instantiated and destroyed many times, this would result in a *memory leak*. Start by declaring `unsubscribe` in `App.svelte`: ```js const unsubscribe = count.subscribe(value => { count_value = value; }); ``` > Calling a `subscribe` method returns an `unsubscribe` function. You now declared `unsubscribe`, but it still needs to be called, for example through the `onDestroy` [lifecycle hook](tutorial/ondestroy): ```html