<i id='ebhQp'><tr id='ebhQp'><dt id='ebhQp'><q id='ebhQp'><span id='ebhQp'><b id='ebhQp'><form id='ebhQp'><ins id='ebhQp'></ins><ul id='ebhQp'></ul><sub id='ebhQp'></sub></form><legend id='ebhQp'></legend><bdo id='ebhQp'><pre id='ebhQp'><center id='ebhQp'></center></pre></bdo></b><th id='ebhQp'></th></span></q></dt></tr></i><div id='ebhQp'><tfoot id='ebhQp'></tfoot><dl id='ebhQp'><fieldset id='ebhQp'></fieldset></dl></div>
  • <tfoot id='ebhQp'></tfoot>

    <small id='ebhQp'></small><noframes id='ebhQp'>

    1. <legend id='ebhQp'><style id='ebhQp'><dir id='ebhQp'><q id='ebhQp'></q></dir></style></legend>

        <bdo id='ebhQp'></bdo><ul id='ebhQp'></ul>

      1. OpenSSL::SSL_library_init() 内存泄漏

        OpenSSL::SSL_library_init() memory leak(OpenSSL::SSL_library_init() 内存泄漏)

                <bdo id='O8jPg'></bdo><ul id='O8jPg'></ul>
                <tfoot id='O8jPg'></tfoot>

                  <small id='O8jPg'></small><noframes id='O8jPg'>

                  <i id='O8jPg'><tr id='O8jPg'><dt id='O8jPg'><q id='O8jPg'><span id='O8jPg'><b id='O8jPg'><form id='O8jPg'><ins id='O8jPg'></ins><ul id='O8jPg'></ul><sub id='O8jPg'></sub></form><legend id='O8jPg'></legend><bdo id='O8jPg'><pre id='O8jPg'><center id='O8jPg'></center></pre></bdo></b><th id='O8jPg'></th></span></q></dt></tr></i><div id='O8jPg'><tfoot id='O8jPg'></tfoot><dl id='O8jPg'><fieldset id='O8jPg'></fieldset></dl></div>

                    <tbody id='O8jPg'></tbody>
                  <legend id='O8jPg'><style id='O8jPg'><dir id='O8jPg'><q id='O8jPg'></q></dir></style></legend>

                  本文介绍了OpenSSL::SSL_library_init() 内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  最近我开始研究C++内存泄漏,所以我可能会问一些幼稚的问题.
                  我有一个使用 OpenSSL 的 c++ 库 - 我的任务是检查这个库中是否存在内存泄漏.我已经运行 Visual Leak Detector 来检查内存泄漏.
                  我看到对 SSL_library_init();SSL_load_error_strings(); 的调用导致泄漏 - 快速谷歌搜索显示在使用结束时我必须调用以下内容:

                  Recently I have started studying about memory leaks in C++, so I may ask a naive questions.
                  I have a c++ library that is using OpenSSL - my task is to check if there are memory leaks in this lib. I have run Visual Leak Detector to check mem leaks.
                  I see that the calls to SSL_library_init(); and SSL_load_error_strings(); are leading leak - quick googling is showing that at the end of usage I have to call the followings:

                  CONF_modules_free();
                  ERR_remove_state(0);
                  ENGINE_cleanup();
                  CONF_modules_unload(1);
                  ERR_free_strings();
                  EVP_cleanup();
                  CRYPTO_cleanup_all_ex_data();
                  

                  泄漏确实减少了,但仍然有两个泄漏(VLD 工具显示给我)是因为 SSL_library_init 调用而发生的.
                  有谁知道我还需要做什么才能释放所有内存泄漏?

                  The leak indeed decreased, but still there are two leaks(that the VLD tool shows me) that happen because the SSL_library_init call.
                  does anyone know what else I have to do in order to free all the mem leaks?

                  推荐答案

                  据我所知,所有在 SSL_library_init()SSL_load_error_strings() 期间分配的内存都被存储在全局变量中,因此它属于正在使用的内存"类别,而不是属于内存泄漏"类别,因为当程序即将消失时,内存仍然可以访问.

                  As I understand all the memory which is allocated during SSL_library_init() and SSL_load_error_strings() are stored in global variables and so it comes under the category of "Memory in Use" rather under the category of Memory leak as the memory is still accessible when the program is dying out.

                  一个建议是 ERR_remove_state(0) 必须在使用 SSL 的每个线程中调用,因为当您使用参数 0 调用 ERR_remove_state 时,它只会清除当前线程的错误状态.其他电话对我来说似乎很好.如果你能发一下 VLD 仍在显示的两次泄漏",我可以检查一下.

                  One suggestion is that ERR_remove_state(0) must be called in each thread where SSL is used, because when you call the ERR_remove_state with argument 0, it just clears the error state for the current thread. Other calls appears good to me. If you could post, "two leaks" which are still being displayed by VLD, I can check.

                  这篇关于OpenSSL::SSL_library_init() 内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Constructor initialization Vs assignment(构造函数初始化 Vs 赋值)
                  Is a `=default` move constructor equivalent to a member-wise move constructor?(`=default` 移动构造函数是否等同于成员移动构造函数?)
                  Has the new C++11 member initialization feature at declaration made initialization lists obsolete?(声明时新的 C++11 成员初始化功能是否使初始化列表过时了?)
                  Order of constructor call in virtual inheritance(虚继承中构造函数调用的顺序)
                  How to use sfinae for selecting constructors?(如何使用 sfinae 选择构造函数?)
                  Initializing a union with a non-trivial constructor(使用非平凡的构造函数初始化联合)

                      • <i id='TcaqB'><tr id='TcaqB'><dt id='TcaqB'><q id='TcaqB'><span id='TcaqB'><b id='TcaqB'><form id='TcaqB'><ins id='TcaqB'></ins><ul id='TcaqB'></ul><sub id='TcaqB'></sub></form><legend id='TcaqB'></legend><bdo id='TcaqB'><pre id='TcaqB'><center id='TcaqB'></center></pre></bdo></b><th id='TcaqB'></th></span></q></dt></tr></i><div id='TcaqB'><tfoot id='TcaqB'></tfoot><dl id='TcaqB'><fieldset id='TcaqB'></fieldset></dl></div>

                      • <tfoot id='TcaqB'></tfoot>
                            <tbody id='TcaqB'></tbody>
                          <legend id='TcaqB'><style id='TcaqB'><dir id='TcaqB'><q id='TcaqB'></q></dir></style></legend>
                          • <bdo id='TcaqB'></bdo><ul id='TcaqB'></ul>

                          • <small id='TcaqB'></small><noframes id='TcaqB'>