yanyiwu / gosimhash

中文文档simhash值计算

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gosimhash 与 gojieba 一起运行时抛错

zerozh opened this issue · comments

环境:Ubuntu 16.04, go version go1.9.1 linux/amd64

Go代码 a.go

package main

import (
	"github.com/yanyiwu/gojieba"
	"github.com/yanyiwu/gosimhash"
)

func main() {
	hasher := gosimhash.New("./dict/jieba.dict.utf8", "./dict/hmm_model.utf8", "./dict/idf.utf8", "./dict/stop_words.utf8")
	defer hasher.Free()

	x := gojieba.NewJieba("./dict/jieba.dict.utf8", "./dict/hmm_model.utf8", "./dict/user.dict.utf8", "./dict/idf.utf8", "./dict/stop_words.utf8")
	defer x.Free()
}

运行结果

zero@black ~/go/src/sh $ go run a.go 
fatal error: unexpected signal during runtime execution
[signal SIGFPE: floating-point exception code=0x1 addr=0x46f82d pc=0x46f82d]

runtime stack:
runtime.throw(0x4af267, 0x2a)
	/usr/local/go/src/runtime/panic.go:605 +0x95
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:351 +0x2b8

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x47d490, 0xc420053e88, 0x16)
	/usr/local/go/src/runtime/cgocall.go:132 +0xe4 fp=0xc420053e58 sp=0xc420053e18 pc=0x40ad94
github.com/yanyiwu/gosimhash._Cfunc_NewSimhasher(0x7dec60, 0x7df040, 0x7df060, 0x7df080, 0x0)
	github.com/yanyiwu/gosimhash/_obj/_cgo_gotypes.go:87 +0x4e fp=0xc420053e88 sp=0xc420053e58 pc=0x46933e
github.com/yanyiwu/gosimhash.New(0x4ac5f2, 0x16, 0x4ac3e5, 0x15, 0x4ab598, 0xf, 0x4ac608, 0x16, 0x40dad4)
	/home/zero/go/src/github.com/yanyiwu/gosimhash/simhash.go:16 +0xd1 fp=0xc420053ed8 sp=0xc420053e88 pc=0x469521
main.main()
	/home/zero/go/src/sh/a.go:9 +0x87 fp=0xc420053f80 sp=0xc420053ed8 pc=0x4696f7
runtime.main()
	/usr/local/go/src/runtime/proc.go:185 +0x20d fp=0xc420053fe0 sp=0xc420053f80 pc=0x42ff3d
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc420053fe8 sp=0xc420053fe0 pc=0x456fd1
exit status 2
commented

+1