c++ - 调用外部 C++ 函数和内存泄漏 : is all allocated memory cleaned up after finishing Python script?

标签 c++ python ctypes

Python 脚本调用外部 C++ 函数(使用 ctypes)。执行 C++ 函数时可能会发生内存泄漏。

是否会在 Python 脚本完成后自动清除所有分配的内存(在 C++ 函数中)?

最佳答案

是的,一旦python解释器退出,就会全部返回给OS。这对所有进程都是如此 - 没有特定于 python 或 c++ 的东西。

关于c++ - 调用外部 C++ 函数和内存泄漏 : is all allocated memory cleaned up after finishing Python script?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6129933/

相关文章:

c++ - 如何在 C++ 中终止程序

c++ - switch 语句可以使用变量吗?

python - 空白 Pygame 屏幕

python - url 查询中的字符 %7D 是什么意思?

python - SetWindowLongW & 错误 1413

Python Ctypes : convert list of integers to array of shorts

c++ const 不适用于头文件原型(prototype) - 重新声明或无原型(prototype)错误

c++ - 如何在没有访问权限的情况下删除对象?

python - 无法在 for 循环中使用 datetime.strptime()

python - 如何在Python中创建空的C类型数组(或只是一个NULL值)?