DLL卸载时内存泄漏 [英] Memory leaks on DLL unload

查看:502
本文介绍了DLL卸载时内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++控制台应用程序在运行时使用LoadLibrary()函数加载DLL,然后调用由DLL导出的某些函数。一旦应用程序完成了DLL,它调用FreeLibrary()函数来卸载DLL。
当DLL被卸载时,由DLL函数调用引起的内存泄漏也会被移除,否则它们将保留在那里,直到应用程序终止。

A C++ console application loads a DLL at run time using LoadLibrary() function and then calls some of the functions exported by the DLL. Once the application is done with the DLL, it calls FreeLibrary() function to unload the DLL. Will the memory leaks caused by the DLL function calls also get removed when the DLL is unloaded or they will remain there untill the application terminates?

推荐答案

内存泄漏将保留。操作系统不关心哪个DLL分配了内存,它只关心哪个进程分配内存。

The memory leaks will remain. The OS doesn't care which DLL allocated the memory, it only cares about which process allocated the memory.

这篇关于DLL卸载时内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆