我正在使用这个代码
from couchbase.cluster import Cluster
from couchbase.cluster import PasswordAuthenticator
cluster = Cluster('couchbase://localhost')
authenticator = PasswordAuthenticator('username', 'password')
cluster.authenticate(authenticator)
cb = cluster.open_bucket('bucket-name')
while True :
cb.get('key1').value在24小时内执行> 500次/秒的操作。
10分钟后,连接断开,进程终止。假设SDK有一些内存问题...
如何解决这个问题?我需要重置连接吗?
找到原点: cb.get('key1').value返回100,000个字符串的python列表。此查询每秒执行100次。--> Python解释器增加了OS分配(即使我们使用gc.collect),最终被OS杀死。
--> Python管理大列表+ realloc操作系统内存的问题。
发布于 2018-03-24 16:24:09
找到原点:
cb.get('key1').value returns a python list of 100,000 string.
This query is done 100 times a second.
--> Python interpreter increases OS allocation (even we use gc.collect)
And ends up being killed by OS .--> Python管理大列表+ realloc操作系统内存的问题。
参考资料:
https://chase-seibert.github.io/blog/2013/08/03/diagnosing-memory-leaks-python.html
https://stackoverflow.com/questions/49389873
复制相似问题