Open hlherrera opened 5 years ago
Hi, you should try to declare textClassifier
as a reference variable at top level of controller. Don't create new in every requests.
Example:
Controller.js
model: string //path
textClassifier = new Fasttext(model);
postMethod(text) {
return textClassifier.predict(text);
}
if I have an express controller:
Controller.js
`model: string //path
postMethod(text) { const textClassifier = new Fasttext(model); // here memory leak! return textClassifier.predict(text); } ` Memory grows without limit on every request.