Closed hasandiwan closed 5 months ago
As mentioned in the docs, loading all language models requires between 3.5 and 4.0 GB of memory. They are loaded into HashMap
s which consume a lot of memory.
In your method, you are recreating the LanguageDetector
on every request. This is costly, completely unnecessary and most likely produces the OutOfMemoryError
. Only create the LanguageDetector
instance once in a global place and reuse it throughout in your application. This should probably fix your problems.
Since you have not replied anymore, I'm assuming that your memory problems have been fixed. That's why I'm closing this issue now. Feel free to re-open it if my assumption is wrong. Thank you.
When I issue the curl command:
To an
@PostMapping
endpoint, defined as:I'm expecting the JSON to contain
{"language": "French"}
, but I get an OutOfMemoryError... what gives?