Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Accumulation of memory usage in tests #85

Closed
borkdude opened this issue Dec 10, 2018 · 4 comments
Closed

Accumulation of memory usage in tests #85

borkdude opened this issue Dec 10, 2018 · 4 comments

Comments

@borkdude
Copy link
Owner

Most namespaces use lazy seq and delays or memoized functions at the top level. This accumulates used memory and eventually causes problems for the later tests.

One approach to solve this could be: delete the namespace after the last test using a global fixture.

@borkdude borkdude changed the title Purge namespace after last test to free up memory Accumulation of memory in tests Dec 10, 2018
@borkdude borkdude changed the title Accumulation of memory in tests Accumulation of memory usage in tests Dec 10, 2018
@borkdude
Copy link
Owner Author

Something like this for the JVM might work:

(run! #(alter-var-root % (fn [_] nil)) (vals (ns-publics 'aoc.y2018.d01.borkdude)))

@borkdude
Copy link
Owner Author

For CLJS the following might work:

(gobject/remove (goog.getObjectByName (munge (namespace sym))) (munge (name sym)))

@mfikes
Copy link
Contributor

mfikes commented Dec 10, 2018

Under :advanced namespaces and vars get flattened. For example, with :pseudo-names true, aoc.y2018.d05.mfikes/part-2 gets flattened to $aoc$y2018$d05$mfikes$part_2$$.

The vars themselves still exists as separate objects. So for example the attached tests end up looking like:

$aoc$y2018$d05$mfikes$part_2$$.$cljs$lang$test$

The trick would be to somehow find the vars retaining data. (I don't think there is a way to remove an entire namespace.)

@borkdude
Copy link
Owner Author

Closing because running all the tests is not necessary anymore for comparing test timings.

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

No branches or pull requests

2 participants