Skip to content

continuous load test generate an error and the memory grows significantly #143

Answered by MichelML
ShangChien asked this question in Q&A
Discussion options

You must be logged in to vote

@ShangChien thank you for your question,

since the mol and qmol objects are c++ objects coming from the wasm module, you need to delete them explicitly and not only nullify them.

See example here:
https://github.com/rdkit/rdkit-js/blob/master/examples/react/src/components/MoleculeStructure/MoleculeStructure.js#L92

See the emscripten reference here:
https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management

If you still get the error after changing:

  qmol=null ;
  mol=null;

for

  qmol.delete();
  qmol = null;
  mol.delete();
  mol = null;

Let us know. Also, in my production code I have a small wrapper to avoid a double statement of deleting and nullify…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ptosco
Comment options

@ShangChien
Comment options

Answer selected by ShangChien
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants