0
votes

I am trying to test all my library and main project's modules by using the static-check option in xdmp:spawn. I'm using a filesystem modules database and this works well for a small number of files. MarkLogic consumes memory as it loads each module until the box consumes all available memory and causes MarkLogic to crash as memory is exhausted.

I have discovered that there is a function called xdmp:module-cache-clear() in MarkLogic 8, but the same function does not seem to exist in MarkLogic version 7.

What would be the best way to clear the cache that is used by modules when they are loaded? Or Is there a way to keep modules from using a cache?

2
Sounds odd. Did you try xdmp:eval instead of xdmp:spawn? - grtjn
xdmp:spawn is the only one that allows static-checking. - spig
Not according to the docs: docs.marklogic.com/xdmp:eval - grtjn
The docs aren't completely thorough however. The eval changes nothing. - spig
One thing I have tried that works for me is to set the module cache to a low timeout value - group-set-module-cache-timeout. This seems to work fine for now. - spig

2 Answers

3
votes

ML7 does not have the cache clearing function, but you can force the module cache to clear by updating something (anything) in the modules database and then executing some query that wants to cache a module.

I am surprised that your module cache is causing you problems in this way. How many modules do you have? Perhaps there is a way you can partition the code so that more code is shared in a few library modules?

1
votes

If you are using a filesystem modules database instead of a real database, you can force a module cache clear by updating something in your schemas database instead. Just updating the module on the filesystem only invalidates that module, but won't clear the cache generally.