今天爱分享给大家带来哪些操作会导致Python内存泄露,怎么处理?【面试题详解】,希望能够帮助到大家。
在使用KafkaProducer 进行消息读写的时候, 错误的配置了buffer_memory参数的值, 导致每次进行 类调用, 都导致客户端不断的重复写内存,并且因为最开始没有使用单例模式,导致内存不断上升,最后溢出。 解决办法就是修正错误的配置了buffer_memory参数的值 和使用单例
buffer_memory (int): The total bytes of memory the producer should use to buffer records waiting to be sent to the server. If records are sent faster than they can be delivered to the server the producer will block up to max_block_ms, raising an exception on timeout. In the current implementation, this setting is an approximation. Default: 33554432 (32MB)