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

Option to not cache flows or export the flow cache in index.js #76

Closed
atrniv opened this issue Sep 10, 2013 · 1 comment
Closed

Option to not cache flows or export the flow cache in index.js #76

atrniv opened this issue Sep 10, 2013 · 1 comment
Assignees

Comments

@atrniv
Copy link

atrniv commented Sep 10, 2013

I use nools to create a large number of flows dynamically from a set of flow definitions. Each flow definition is stored by a unique name which i use to create the flow object.

These flow objects are then managed by a LRU cache which disposes the flow object when required.

However in certain scenarios the LRU cache is destroyed and dispose is not called. In this case I have no more references available of all my previously created flows and when i try to recreate them I get an error saying they already exist.

I can bypass this by asking nools if the flow exists before recreating it.

However what do I do in the scenario when I never recreate a flow again. Wouldn't there be a memory leak caused due the reference maintained on the flows cache in index.js ?

An example to show more clearly what i mean

  • I create cache 1
  • I create Flow A and store in cache 1
  • I create Flow B and store in cache 1
  • I delete cache 1
  • I create cache 2
  • I create Flow A and find it already exists so i use it and store it in cache 2
  • I create Flow C and store it in cache 2

In this case if i never try to create Flow B again it will forever remain in the flows object and never be removed from memory.

I think there should be an option to disable storing a created flow in the flows cache in index.js or else this should be exported so that it can be cleared manually when needed.

@ghost ghost assigned doug-martin Sep 11, 2013
doug-martin added a commit to doug-martin/nools that referenced this issue Sep 24, 2013
* Fixed issue noolsjs#68 where `matchUntilHalt` uses a lot of CPU
* Fixed issue noolsjs#45, now compiled rules support `or` constraint with more than 2 inner constraints.
* Added new feature to address noolsjs#76, now you can use `deleteFlows` to dispose all flows, or use `hasFlow` to check if a flow is already registred with `nools`.
@doug-martin doug-martin mentioned this issue Sep 24, 2013
@doug-martin
Copy link
Contributor

As of v0.1.13 you can call nools.deleteFlows which will clear all flows or you can call nools.hasFlow to check if a flow exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants