Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的代码有效,但出现以下警告:
swig/python detected a memory leak of type 'time_t *', no destructor found
我怎样才能让它平静下来?
只需添加typedef long time_t;到您的 SWIG 接口文件中。
typedef long time_t;
一旦 SWIG 知道这time_t是本机类型,它就不会被视为需要内存管理的对象。
time_t
每当我访问包含未 SWIG 包装的类型的结构成员时,我都会收到此错误。不确定这是否是您的问题(发布您的代码会有所帮助:P),但如果是这样,那么您可以在接口文件中定义您的自定义 time_t(只需将 C 定义放在接口文件中),或者告诉 SWIG 包装(大概)包含time_t定义的系统头文件。