jieba-php icon indicating copy to clipboard operation
jieba-php copied to clipboard

超出内存限制

Open linhongzhao321 opened this issue 6 years ago • 4 comments

场景 默认精确度,初始化完成后,在swoole协程中循环运行。大概执行 1W+ 次分词后,会报超出内存限制,从报错前一刻最后一个数据开始重新执行分词任务,又会继续正常运行,但执行1W+次分词后又会再次出现。 PHP Fatal error: Allowed memory size of 335544320 bytes exhausted (tried to allocate 1179648 bytes) in /<隐藏路径>/vendor/fukuball/jieba-php/src/vendor/multi-array/MultiArray.php on line 121

疑问 请问有什么原因吗?或者是我需要提供更具体的信息?

linhongzhao321 avatar Oct 08 '19 11:10 linhongzhao321

swoole协程是单线程模型,我想这个问题应该与是否在协程中执行无关

linhongzhao321 avatar Oct 08 '19 11:10 linhongzhao321

改用small dict后问题解决,但不明白问题原因

linhongzhao321 avatar Oct 08 '19 11:10 linhongzhao321

使用small,运行分析100W+次分析,依然超出内存,并不能根本解决问题

linhongzhao321 avatar Oct 09 '19 01:10 linhongzhao321

@linhongzhao321 這樣看起來似乎是字典不斷在過程中被擴充,可以檢查一下使用方式為何會讓字典不斷擴大(比如印出 Array 的大小,基本上過程中不應該不斷擴大的)

fukuball avatar Oct 14 '19 08:10 fukuball