Open liu86th opened 10 months ago
I guess that the problem here is that you are trying to invoke x.Free()
manually.
Actually, I add this line in order to make the golang GC to manage the underlying jieba memory which i consider the right way to write go program. https://github.com/yanyiwu/gojieba/pull/96
A quick fix is removing your manual invokation to the Free
method and let the FInalizer do the free job.
My personal opinion is that the Free
method should be private here. Because if gojieba
keeps the Free
method and rely on the user to manage the jieba memory, all the go objects that contain (directly or indirectly) the jieba
instance will rely on the user to manage memory, which is not an ideal go pattern.
运行一段时间自动崩了,去掉x.Free() 这个就不会崩,但是内存占用好大啊,部署到k8s中去的时候