首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Axis2C内存泄漏?

Axis2C内存泄漏?
EN

Stack Overflow用户
提问于 2012-04-11 22:50:55
回答 2查看 927关注 0票数 0

我和Axis2C一起工作。为了测试这个框架,我用一个简单的web服务客户端做了一些测试。

我使用Apache提供的一些示例和文档编写了客户端。客户端运行良好,我决定使用valgrind对其进行测试,以确保内存管理是正确的。

我使用了示例和文档中提到的函数来释放内存(在本例中):

代码语言:javascript
复制
// to free the requst struct.
 adb_EncryptRequest_free(request, env);

 // to free the stub.
 axis2_stub_free(stub, env);

 // to free the environment.
 axutil_env_free((axutil_env_t*) env);

我在代码中没有任何“狂野”的new或malloc。

但是,valgrind报告了以下内容:

代码语言:javascript
复制
LEAK SUMMARY:
==2287==    definitely lost: 56 bytes in 3 blocks
==2287==    indirectly lost: 156 bytes in 5 blocks
==2287==      possibly lost: 0 bytes in 0 blocks
==2287==    still reachable: 20 bytes in 1 blocks
==2287==         suppressed: 0 bytes in 0 blocks

我使用--leak check=full重新运行了Valgind,但据我所知,内存问题位于axis2c *.so文件中。

代码语言:javascript
复制
HEAP SUMMARY:
==2292==     in use at exit: 232 bytes in 9 blocks
==2292==   total heap usage: 13,180 allocs, 13,171 frees, 760,422 bytes allocated
==2292== 
==2292== 68 (16 direct, 52 indirect) bytes in 1 blocks are definitely lost in loss record 7 of 9
==2292==    at 0x400677E: malloc (vg_replace_malloc.c:195)
==2292==    by 0x40C2032: axutil_allocator_malloc_impl (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x40C5C07: axutil_string_create (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x804E024: axis2_stub_start_op_PoCPCIServiceService_GetEncryptedData (axis2_stub_PoCPCIServiceService.c:493)
==2292==    by 0x804E759: main (main.c:59)
==2292== 
==2292== 72 (20 direct, 52 indirect) bytes in 1 blocks are definitely lost in loss record 8 of 9
==2292==    at 0x400677E: malloc (vg_replace_malloc.c:195)
==2292==    by 0x40C2032: axutil_allocator_malloc_impl (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x40C74F5: axutil_qname_create (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x804D515: axis2_stub_populate_services_for_PoCPCIServiceService (axis2_stub_PoCPCIServiceService.c:91)
==2292==    by 0x804D395: axis2_stub_create_PoCPCIServiceService (axis2_stub_PoCPCIServiceService.c:48)
==2292==    by 0x804E6ED: main (main.c:46)
==2292== 
==2292== 72 (20 direct, 52 indirect) bytes in 1 blocks are definitely lost in loss record 9 of 9
==2292==    at 0x400677E: malloc (vg_replace_malloc.c:195)
==2292==    by 0x40C2032: axutil_allocator_malloc_impl (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x40C74F5: axutil_qname_create (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x804D64F: axis2_stub_populate_services_for_PoCPCIServiceService (axis2_stub_PoCPCIServiceService.c:111)
==2292==    by 0x804D395: axis2_stub_create_PoCPCIServiceService (axis2_stub_PoCPCIServiceService.c:48)
==2292==    by 0x804E6ED: main (main.c:46)

如果我是对的,有没有办法解决这个问题?

谢谢你的帮助。

致以问候。

EN

回答 2

Stack Overflow用户

发布于 2012-10-14 23:51:24

没有代码,只是猜测而已。我使用的是axis2c (来自svn的1.7.x),没有注意到任何泄漏(用vc中的visual leak detector检查过)。

我只释放了服务客户端和环境。

代码语言:javascript
复制
 axis2_svc_client_free(svc, env);
 axutil_env_free(env);

根据header注释,您使用"axis2_svc_client_send_receive“(在生成的代码中使用)绑定的数据将由服务客户端释放。

票数 0
EN

Stack Overflow用户

发布于 2013-05-08 01:28:58

不幸的是,Axis2/C有 many memory leaks

我们启动了axis2c-unofficial项目,以提供比原来更稳定的Axis2/C版本。

在该项目中有一个list of issues fixed

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10108438

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档