rnons/shadowsocks-haskell

sslocal.exe: mallocPlainForeignPtrBytes: size must be >= 0

Closed this issue · 7 comments

在64位Windows 10上使用64位的sslocal.exe会输出很多这样的信息:

sslocal.exe: mallocPlainForeignPtrBytes: size must be >= 0

但程序用起来没有什么问题

使用32位的sslocal.exe没有以上问题
在64位Debian 8上使用64位的sslocal也没有以上问题

Server:
Debian 8 64-bit:

cabal install shadowsocks

Client:
Windows 10 64-bit:
OpenSSL for Windows:

https://slproweb.com/products/Win32OpenSSL.html

编译64位版本:

cabal install HsOpenSSL --extra-include-dirs=C:\OpenSSL-Win64\include --extra-lib-dirs=C:\OpenSSL-Win64
cabal install shadowsocks

编译32位版本:

cabal install HsOpenSSL --extra-include-dirs=C:\OpenSSL-Win32\include --extra-lib-dirs=C:\OpenSSL-Win32
cabal install shadowsocks
rnons commented

hi, 我现在手边没有Windows,等我装一个来回复你。

rnons commented

我重现了你的问题。看起来和这个issue有关:haskell/network#144

嗯,就是32位的没事儿挺奇怪的,我懂的不够多可能帮不上忙

rnons commented

@ekkolord 能不能麻烦做个实验?首先git clone到本地

然后用不同的指令去编译local.hs

ghc local.hs -O2 -threaded

ghc local.hs -O2

然后执行 .\local.exe -c config.json

-threaded的版本是写在.cabal文件里的版本,在我本地测试的时候,不带-threaded时就不会出现mallocPlainForeignPtrBytes的报错,麻烦你试一下。

ghc local.hs -O2 确实不会出错了,性能上也感觉不到明显不同。

rnons commented

https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/options-phases.html#options-linker

The threaded runtime system provides the following benefits:
It enables the -N RTS option to be used, which allows threads to run in parallel on a multiprocessor or multicore machine

-threaded编出来的exe,可以通过.\local.exe +RTS -N2用上CPU的多个core。

rnons commented

Released as v1.20151028