[英]Keras multi_gpu_model error: "swig/python detected a memory leak of type 'int64_t *', no destructor found"
[英]swig/python detected a memory leak of type 'uint32_t *', no destructor found
当我在结构中编辑或打印字段时,遇到关于内存泄漏的错误,但是如果我使用下面的简单变量(如xx),则不会发生内存泄漏。 这是为什么 ?
文件rc_test.py:
import sys
import verbs_utils
import logging
logger = logging.basicConfig(level=logging.DEBUG)
class rc_pingpong():
def __init__(self, link_partner_hostname=None):
self.attr = verbs_utils.ibv_qp_attr()
self.init_to_rts()
def init_to_rts(self):
self.attr = verbs_utils.ibv_qp_attr()
logging.debug("<DEBUG: init_to_rts>, self.attr = {}".format(self.attr))
logging.debug("<DEBUG: init_to_rts>, self.attr.path_mtu = {}".format(self.attr.path_mtu))
logging.debug("<DEBUG: init_to_rts>, self.attr.min_rnr_timer = {}".format(self.attr.min_rnr_timer))
logging.debug("<DEBUG: init_to_rts>, self.attr.qp_state = {}".format(self.attr.qp_state))
logging.debug("<DEBUG: init_to_rts>, self.attr.port_num = {}".format(self.attr.port_num))
xx = self.attr.dest_qp_num
verbs_utils.set_intp_val(xx , 7)
verbs_utils.print_intp_val(xx)
self.attr.dest_qp_num = xx
#logging.debug("<DEBUG: init_to_rts>, +++++++++ self.attr.dest_qp_num = {}".format(self.attr.dest_qp_num))
verbs_utils.print_intp_val(self.attr.dest_qp_num)
verbs_utils.print_intp_val(self.attr.dest_qp_num)
文件:verbs_utils.c
struct ibv_qp_attr {
uint32_t qkey;
uint32_t rq_psn;
uint32_t sq_psn;
uint32_t dest_qp_num;
};
void set_intp_val(uint32_t* p, int val)
{
*p = val;
printf("----------------------------------------------\n");
printf("<DEBUG : xxxxxxset_intp_val>, p = %d\n", p);
printf("<DEBUG : xxxxxxset_intp_val>, val = %d\n", val);
printf("<DEBUG : xxxxxxset_intp_val>, *p = %d\n", *p);
printf("----------------------------------------------\n");
}
void print_intp_val(uint32_t* p)
{
printf("----------------------------------------------\n");
printf("<DEBUG : xxxxxxset_intp_val>, *p = %d\n", *p);
printf("<DEBUG : xxxxxxset_intp_val>, p = %d\n", p);
printf("----------------------------------------------\n");
}
输出:
----------------------------------------------
<DEBUG : xxxxxxset_intp_val>, p = 8431360
<DEBUG : xxxxxxset_intp_val>, val = 7
<DEBUG : xxxxxxset_intp_val>, *p = 7
----------------------------------------------
----------------------------------------------
<DEBUG : xxxxxxset_intp_val>, *p = 7
<DEBUG : xxxxxxset_intp_val>, p = 8431360
----------------------------------------------
----------------------------------------------
<DEBUG : xxxxxxset_intp_val>, *p = 7
<DEBUG : xxxxxxset_intp_val>, p = 8967344
----------------------------------------------
swig/python detected a memory leak of type 'uint32_t *', no destructor found.
----------------------------------------------
<DEBUG : xxxxxxset_intp_val>, *p = 7
<DEBUG : xxxxxxset_intp_val>, p = 9753776
----------------------------------------------
swig/python detected a memory leak of type 'uint32_t *', no destructor found.
尝试将%include "stdint.i"
添加到界面文件的顶部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.