Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client中的client.close()方法无法析构掉client #289

Open
dyy8888 opened this issue Nov 3, 2024 · 1 comment
Open

client中的client.close()方法无法析构掉client #289

dyy8888 opened this issue Nov 3, 2024 · 1 comment

Comments

@dyy8888
Copy link
Contributor

dyy8888 commented Nov 3, 2024

fisco 2.9.1版本,使用go-sdk时发现,client中的close函数不管用,启动的程序逻辑是每一次收到请求就新建一个client,然后处理结束后defer client.close(),但是程序运行发现,内存占用在不断上升,存在内存泄露,经排查,就是这个client.close()无效。由于对client实现不熟悉,希望提供帮助

@bxq2011hust
Copy link
Member

bxq2011hust commented Nov 5, 2024

推荐的用法是,一直使用同一个client对象,不要每个请求创建一个新的client
如果你使用的是2.0的go-sdk,Close方法只是关闭socket,所有的内存管理都是go runtime管理的,应该不会有内存问题,有可能是因为你频繁创建析构导致的go协程增加带来的内存开销

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants