Node-gpp C ++ leak test with valgrind

Simple enough, how can I run the leak test for the node -gyp C ++ module I just wrote? Most of the imported C ++ code has been tested in different projects, but I would like to make sure there are no leaks.

AFAIK, the only execution mode I've seen is through node:

var wv = require('./build/Release/word_vec.node');                                                                                          
var json = JSON.parse(require('fs').readFileSync('amazon.json', 'utf8'));                                                                   
var res = wv.convert_sparse(json, 5, 6, 0);                                                                                                 

var fs = require('fs');                                                                                                                     
fs.writeFile("output", JSON.stringify(res), function(err) {                                                                                 
    if(err) {                                                                                                                               
        return console.log(err);                                                                                                            
    }                                                                                                                                       
});

The function I want to test is convert_sparsethat which is in word_vec.cppand compiled in ./build/Release/word_vec.nodeor the equivalent debug subdirectory.

+4
source share

Source: https://habr.com/ru/post/1629073/


All Articles