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

Leaking memory? #1

Open
mindplay-dk opened this issue May 24, 2021 · 0 comments
Open

Leaking memory? #1

mindplay-dk opened this issue May 24, 2021 · 0 comments

Comments

@mindplay-dk
Copy link

It looks like this library leaks memory?

import { T, now, log } from 'https://cdn.skypack.dev/timeline-monoid';

const a = T();
const b = (a).sync(a => a * 2);
const c = (a)(b).sync(([a, b]) => a + b);
const abc = (a)(b)(c);

function test() {
  const t = abc.sync(log);
  a[now] = 1;
  // NOTE: `t` falls out of scope here ...
}

test();

a[now] = 5; // ... but `log` still gets invoked

So, once you've added listeners with sync, you're stuck with them forever - there's no way to get rid of them?

If so, this is interesting as a proof of concept (and it's delightfully small) but it doesn't seem like this is going to be useful, for example, in user interfaces, where elements of the UI might get added or removed, be active or inactive, and so on?

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

1 participant