[英]What does "RuntimeWarning: Enable tracemalloc to get the object allocation traceback" mean? I know how to fix, looking for the meaning
When I call a coroutine without awaiting, in addition to a message warning me I have not awaited the coroutine, I also get the following warning message:当我在没有等待的情况下调用协程时,除了警告我没有等待协程的消息外,我还会收到以下警告消息:
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
I know how to fix this ie by awaiting the coroutine (and I do see a lot of questions about this warning, but all the answers are how to fix it; my goal is to understand it; please don't mark my question as duplicate if possible:) );我知道如何通过等待协程来解决这个问题(我确实看到了很多关于这个警告的问题,但所有的答案都是如何解决它;我的目标是理解它;请不要将我的问题标记为重复如果可能的话:) ); in particular, what I'd really like to understand is:
特别是,我真正想了解的是:
My goal in asking this is understanding the details and inner-workings of asyncio better.我提出这个问题的目的是更好地理解 asyncio 的细节和内部工作原理。
tracemalloc is a module that is used to debug memory allocation in python tracemalloc 是一个用于调试 python 中 memory 分配的模块
you can enable it by setting PYTHONTRACEMALLOC environment variable to 1您可以通过将 PYTHONTRACEMALLOC 环境变量设置为 1 来启用它
check the docs for more info Tracemalloc docs检查文档以获取更多信息Tracemalloc 文档
It's a way how python manages memory and allocates memory for it's objects这是 python 管理 memory 并为其对象分配 memory 的一种方式
I guess this is because memory is allocated and never used properly so we get loss of resources ie memory leak我猜这是因为 memory 已分配且从未正确使用,因此我们会丢失资源,即 memory 泄漏
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.