记一个内存泄漏问题
好久之前的事情,遇到了一个比较容易找到的内存泄漏问题 大致就是一个定时任务的写法过于骚气,简化版代码如下 from werkzeug.utils import cached_property class T(object): def __init__(self, api_client): self._api_client = api_client def ping(self) »
IPython 自 7.0 版本开始支持了在 REPL 中直接 await(参考 Asynchronous in REPL: Autoawait),并且对 trio 和 curio 进行支持。可以通过 %autoawait trio 指令切换 IOLoop 然后 Python 3. »
本文使用代码版本为 0.6.0,commit sha 为 d85d12060ed1e3d46201dca0f1da6a9345e2a23d Basic 使用 prometheus_client 来监控 Flask 应用的示例 import time from flask import Flask from flask import g from »
本文研究 Python PEP-3116 New I/O 引入后,Python 层面的 write 和 syscall write 之间的关系。文中所使用的 Python 版本为 3.7.2,commit sha 为 9a3ffc0492d1310ead9ce8f5ee678c26b20a338d Binary Mode »
本文基于 Linux, Python 3.7.2(Commit Sha 9a3ffc0492d1310ead9ce8f5ee678c26b20a338d) Queue 源码 multiprocessing.Queue 内部基于 multiprocessing.Pipe,并且使用 feeder 线程将数据从 Buffer 刷到 PIPE 中 首先来看 Queue 的初始化 »
好久之前的事情,遇到了一个比较容易找到的内存泄漏问题 大致就是一个定时任务的写法过于骚气,简化版代码如下 from werkzeug.utils import cached_property class T(object): def __init__(self, api_client): self._api_client = api_client def ping(self) »
本文所使用的环境 Python3.7.2 gevent1.4.0 gunicron19.9.0 urllib31.24.1 requests=2.21.0 可以说是很早就存在的坑了,但是由于不恰当的解决方式有引发的其他的问题 # app.py import requests from flask import »
本文如无特殊说明,所使用的 Python 版本指 3.6.8,如果你已经了解 https://bugs.python.org/issue30520 那么便不需要继续阅读了 这个事情要从 uvicorn 的一个 issue 说起 #328 # run.py import uvicorn import logging »