通过使用 CPngImage::LoadFromBuffer 方法时使用 Visual Studio 2008 SP1 开发 MFC 应用程序中出现内存泄漏


症状


请考虑以下情形:
  • 运行 Microsoft 基础类 (MFC) 开发应用程序是使用 Visual Studio 2008 Service Pack 1 (SP1)。
  • MFC 应用程序调用一个 CMFCRibbonBar 类来实现功能区栏。
  • 功能区栏包含类别和作为资源使用可移植网络图形 (.png) 图像的按钮。
  • 重复打开和关闭文档自定义功能区栏。

在这种情况下,MFC 应用程序中发生内存泄漏。因此,应用程序的内存使用量增加。

原因


发生此问题是因为在 CPngImage::LoadFromBuffer 方法中的 CreateStreamOnHGlobal 函数分配的内存不会释放。预期的行为是由 CreateStreamOnHGlobal 函数创建一个流释放之后被释放的内存。

解决方案


修补程序信息

受支持的修补程序现已从 Microsoft 推出。但是,它被用于纠正本文中描述的问题。它仅应用于正经历此特定问题的系统。此修补程序可能会接受进一步的测试。因此,如果这个问题没有对您造成严重的影响,我们建议您等待包含此修复程序的下一个软件更新。

要立即解决此问题,请联系 Microsoft 客户支持服务,以获取此修复程序。有关 Microsoft 客户支持服务的电话号码和有关支持费用的信息的完整列表,请访问下面的 Microsoft 网站︰注意: 在特殊情况下,如果 Microsoft 支持专业人员确定某个特定的更新能够解决您的问题,可能取消的通常情况下收取的电话支持服务费用。照常收取支持费用将应用于其他支持问题和对于特定更新无法解决的问题。

系统必备组件

若要应用此修补程序,您必须使用 Visual Studio 2008 的 Service Pack 1,安装。

重启要求

不需要应用此修补程序后,重新启动计算机。

修补程序替换信息

此修补程序不替换任何其他修补程序。

文件信息

此修复程序的英文版具有的文件属性 (或更新的文件属性)在下表中列出。日期和为这些文件的时间以协调世界时 (UTC) 列出。当您查看文件信息时,它将转换为本地时间。要了解 UTC 与本地时间之间的时差,请使用控制面板中的日期和时间项中的时区选项卡。
文件名称文件版本文件大小日期时间平台
Atl90.dll9.0.30729.5054176,45620-Aug-201001:06x64
Atl90.dll9.0.30729.5054416,07220-Aug-201001:15IA-64
Atl90.dll9.0.30729.5054159,04820-Aug-201002:59x86
数组16,41729-Oct-200811:55
数组16,41729-Oct-200811:55
随机83,27329-Oct-200811:55
随机83,27329-Oct-200811:55
元组12,37129-Oct-200811:55
元组12,37129-Oct-200811:55
xxfunction9,84529-Oct-200811:55
xxfunction9,84529-Oct-200811:55
afxframeimpl.cpp56,20424-Oct-200815:03
afxglobals.cpp34,15624-Oct-200815:03
afxglobals.h10,14424-Oct-200815:03
afxtoolbarimages.cpp76,66519-Apr-201016:41
almap.dll18,73619-Apr-201022:27x86
almap.lib17,80819-Apr-201022:27x86
atl.lib20,01219-Apr-201022:31x86
atl.lib21,88219-Apr-201022:49x86
atl.lib19,25619-Apr-201023:24x86
atlassem.h2,03719-Apr-201022:23
atlbuild.h57219-Apr-201022:01
atlcom.h173,18610-Jul-200922:27
atlcomcli.h68,58911-Jul-200912:28
atldb.h384,02919-Apr-201015:47
atldload.lib396,14819-Apr-201022:31x86
atldload.lib493,48019-Apr-201022:49x86
atldload.lib429,02219-Apr-201023:24x86
atlhost.h77,91310-Jul-200919:50
atls.lib1,413,00619-Apr-201022:31x86
atls.lib1,354,52619-Apr-201022:49x86
atls.lib1,114,53619-Apr-201023:24x86
atlsd.lib1,784,14419-Apr-201022:31x86
atlsd.lib2,031,79819-Apr-201022:49x86
atlsd.lib1,605,96019-Apr-201023:24x86
bardock.cpp25,37230-Oct-200909:15
comdef.h8,73112-Aug-200915:14
crtassem.h95119-Apr-201022:22x86
crtassem.h1,29819-Apr-201022:23
crtdefs.h107,91919-Apr-201022:23
crtdefs.h97,32712-Aug-200917:54x86
intrin.h89,12912-Aug-200917:54x86
intrin.h91,68319-Apr-201022:23
libcmt.lib9,217,40819-Apr-201022:31x86
libcmt.lib12,760,90819-Apr-201022:43x86
libcmt.lib10,007,01219-Apr-201023:24x86
libcmtd.lib11,361,33019-Apr-201022:31x86
libcmtd.lib16,469,32419-Apr-201022:44x86
libcmtd.lib12,749,53619-Apr-201023:24x86
libcpmt.lib5,349,92819-Apr-201022:31x86
libcpmt.lib8,755,30419-Apr-201022:45x86
libcpmt.lib6,963,46219-Apr-201023:24x86
libcpmtd.lib6,781,27019-Apr-201022:31x86
libcpmtd.lib11,714,09019-Apr-201022:45x86
libcpmtd.lib9,299,51819-Apr-201023:24x86
mfc90.lib5,196,14819-Apr-201023:52x64
mfc90.lib5,197,22419-Apr-201023:16x86
mfc90d.lib6,026,79219-Apr-201023:53x64
mfc90d.lib6,017,75619-Apr-201023:16x86
mfc90u.lib6,501,18619-Apr-201023:53x64
mfc90u.lib6,595,79219-Apr-201023:17x86
mfc90ud.lib7,541,86219-Apr-201023:53x64
mfc90ud.lib7,622,20619-Apr-201023:17x86
mfc.bsc18,705,40820-Aug-201000:53
mfc_loc.manifest5,88220-Aug-201003:03x86
mfcassem.h3,14319-Apr-201022:54
mfcdload.lib780,35419-Apr-201023:50x86
mfcm90.lib43,10419-Apr-201023:54x64
mfcm90.lib41,05219-Apr-201023:18x86
mfcm90d.lib46,18219-Apr-201023:54x64
mfcm90d.lib44,59619-Apr-201023:18x86
mfcm90u.lib44,54819-Apr-201023:54x64
mfcm90u.lib42,46019-Apr-201023:18x86
mfcm90ud.lib47,64019-Apr-201023:54x64
mfcm90ud.lib46,01419-Apr-201023:18x86
mfcs90.lib1,054,70619-Apr-201023:50x86
mfcs90.lib1,048,94419-Apr-201023:14x86
mfcs90d.lib1,049,10819-Apr-201023:50x64
mfcs90d.lib1,020,31219-Apr-201023:14x86
mfcs90u.lib1,068,31019-Apr-201023:51x64
mfcs90u.lib1,063,03019-Apr-201023:15x86
mfcs90ud.lib1,065,49619-Apr-201023:51x86
mfcs90ud.lib1,035,73019-Apr-201023:14x86
microsoft.vc90.atl.manifest85820-Aug-201001:10x64
microsoft.vc90.atl.manifest85720-Aug-201001:20IA-64
microsoft.vc90.atl.manifest为 85620-Aug-201003:03x86
microsoft_vc90_atl_x86_ia64.msm229,88820-Aug-201011:29IA-64
microsoft_vc90_atl_x86.msm150,52820-Aug-201009:54x86
microsoft_vc90_atl_x86_x64.msm151,55220-Aug-201010:45x64
microsoft.vc90.crt.manifest1,86220-Aug-201001:10x64
microsoft.vc90.crt.manifest1,86120-Aug-201001:20IA-64
microsoft.vc90.crt.manifest1,86020-Aug-201003:03x86
microsoft_vc90_crt_x86_ia64.msm1,041,40820-Aug-201011:24IA-64
microsoft_vc90_crt_x86.msm614,91220-Aug-201009:18x86
microsoft_vc90_crt_x86_x64.msm648,19220-Aug-201010:39x64
microsoft.vc90.debugcrt.manifest1,87020-Aug-201001:10x64
microsoft.vc90.debugcrt.manifest1,86920-Aug-201001:20IA-64
microsoft.vc90.debugcrt.manifest1,86820-Aug-201003:03x86
microsoft_vc90_debugcrt_x86_ia64.msm1,811,45620-Aug-201011:19IA-64
microsoft_vc90_debugcrt_x86.msm839,16820-Aug-201009:12x86
microsoft_vc90_debugcrt_x86_x64.msm844,28820-Aug-201010:34x64
microsoft.vc90.debugmfc.manifest2,36820-Aug-201001:10x64
microsoft.vc90.debugmfc.manifest2,36620-Aug-201003:03x86
microsoft_vc90_debugmfc_x86_ia64.msm4,759,04007-Nov-200705:58IA-64
microsoft_vc90_debugmfc_x86.msm5,569,02420-Aug-201009:39x86
microsoft_vc90_debugmfc_x86_x64.msm5,985,79220-Aug-201010:24x64
microsoft.vc90.debugopenmp.manifest86720-Aug-201003:03x86
microsoft.vc90.debugopenmp.manifest86820-Aug-201001:20x86
microsoft.vc90.debugopenmp.manifest86920-Aug-201001:10x86
microsoft_vc90_debugopenmp_x86_ia64.msm157,69620-Aug-201010:50IA-64
microsoft_vc90_debugopenmp_x86.msm108,54420-Aug-201009:23x86
microsoft_vc90_debugopenmp_x86_x64.msm107,52020-Aug-201009:59x64
microsoft.vc90.mfc.manifest2,35920-Aug-201001:10x64
microsoft.vc90.mfc.manifest2,35720-Aug-201003:03x86
microsoft_vc90_mfc_x86_ia64.msm2,600,96007-Nov-200706:10IA-64
microsoft_vc90_mfc_x86.msm4,188,16020-Aug-201009:46x86
microsoft_vc90_mfc_x86_x64.msm4,883,45620-Aug-201010:29x64
microsoft.vc90.mfcloc.manifest5,88420-Aug-201001:10x64
microsoft.vc90.mfcloc.manifest5,88220-Aug-201003:03x86
microsoft_vc90_mfcloc_x86_ia64.msm242,17607-Nov-200706:18IA-64
microsoft_vc90_mfcloc_x86.msm259,07220-Aug-201009:33x86
microsoft_vc90_mfcloc_x86_x64.msm257,02420-Aug-201010:18x64
microsoft.vc90.openmp.manifest86120-Aug-201003:03x86
microsoft.vc90.openmp.manifest86220-Aug-201001:20x86
microsoft.vc90.openmp.manifest86320-Aug-201001:10x86
microsoft_vc90_openmp_x86_ia64.msm124,41620-Aug-201010:55IA-64
microsoft_vc90_openmp_x86.msm98,30420-Aug-201009:28x86
microsoft_vc90_openmp_x86_x64.msm98,81620-Aug-201010:13x64
msvcmrt.lib1,529,80819-Apr-201022:31x86
msvcmrt.lib1,697,61219-Apr-201023:24x86
msvcmrt.lib1,846,52619-Apr-201022:46x86
msvcmrtd.lib1,625,96019-Apr-201022:31x86
msvcmrtd.lib1,804,92619-Apr-201023:24x86
msvcmrtd.lib1,956,88219-Apr-201022:47x86
msvcprt.lib1,654,51619-Apr-201022:31x86
msvcprt.lib2,140,98619-Apr-201022:45x86
msvcprt.lib1,686,81819-Apr-201023:24x86
msvcprtd.lib1,827,18619-Apr-201022:31x86
msvcprtd.lib2,369,33219-Apr-201022:45x86
msvcprtd.lib1,860,04019-Apr-201023:24x86
msvcrt.lib1,360,06819-Apr-201022:31x86
msvcrt.lib1,585,29619-Apr-201022:44x86
msvcrt.lib1,357,32219-Apr-201023:24x86
msvcrtd.lib1,392,99019-Apr-201022:31x86
msvcrtd.lib1,642,42819-Apr-201022:44x86
msvcrtd.lib1,400,23419-Apr-201023:24x86
msvcurt.lib15,375,46619-Apr-201022:31x86
msvcurt.lib15,737,14819-Apr-201023:24x86
msvcurt.lib15,882,48219-Apr-201022:46x86
msvcurtd.lib16,952,22619-Apr-201022:31x86
msvcurtd.lib17,303,53819-Apr-201023:24x86
msvcurtd.lib17,454,85219-Apr-201022:47x86
nafxcw.lib49,963,83619-Apr-201023:17x86
nafxcw.lib59,306,38819-Apr-201023:53x86
nafxcwd.lib52,949,40019-Apr-201023:16x86
nafxcwd.lib66,787,59219-Apr-201023:53x86
nmmintrin.h4,09119-Apr-201022:23x86
nmmintrin.h3,96712-Aug-200917:54
ompassem.h95119-Apr-201022:56
ptrustm.lib426,51819-Apr-201022:31x86
ptrustmd.lib433,69019-Apr-201022:31x86
ptrustu.lib426,51819-Apr-201022:31x86
ptrustud.lib433,69019-Apr-201022:31x86
sdknames.lib7,46219-Apr-201022:27x86
tcmap.lib29,67619-Apr-201022:27x86
tcmapdll.lib32,05819-Apr-201022:27x86
uafxcw.lib50,880,30019-Apr-201023:17x86
uafxcw.lib60,097,30619-Apr-201023:54x86
uafxcwd.lib54,310,59419-Apr-201023:17x86
uafxcwd.lib68,073,04019-Apr-201023:53x86
vcomp.lib28,44619-Apr-201023:28x86
vcomp.lib27,89019-Apr-201023:55x86
vcomp.lib33,22019-Apr-201023:52x86
vcompd.dll27,99819-Apr-201023:55x86
vcompd.lib28,57419-Apr-201023:28x86
vcompd.lib33,33019-Apr-201023:52x86
wchar.h75,91812-Aug-200917:54x86
xutility128,83812-Aug-200915:14
xutility128,56312-Aug-200917:54
yvals.h21,52712-Aug-200917:54
Mfc90.dll9.0.30729.50545,083,46420-Aug-201001:06x64
Mfc90.dll9.0.30729.50543,765,06420-Aug-201002:59x86
Mfc90chs.dll9.0.30729.505435,66420-Aug-201001:06x64
Mfc90chs.dll9.0.30729.505435,66420-Aug-201002:59x86
Mfc90cht.dll9.0.30729.505436,68820-Aug-201001:06x64
Mfc90cht.dll9.0.30729.505436,68820-Aug-201002:59x86
Mfc90d.dll9.0.30729.50547,418,18420-Aug-201001:06x64
Mfc90d.dll9.0.30729.50545,933,89620-Aug-201002:59x86
Mfc90deu.dll9.0.30729.505463,31220-Aug-201001:06x64
Mfc90deu.dll9.0.30729.505463,31220-Aug-201002:59x86
Mfc90enu.dll9.0.30729.505453,58420-Aug-201001:06x64
Mfc90enu.dll9.0.30729.505453,58420-Aug-201002:59x86
Mfc90esn.dll9.0.30729.505461,77620-Aug-201001:06x64
Mfc90esn.dll9.0.30729.505461,77620-Aug-201002:59x86
Mfc90esp.dll9.0.30729.505461,77620-Aug-201001:06x64
Mfc90esp.dll9.0.30729.505461,77620-Aug-201002:59x86
Mfc90fra.dll9.0.30729.505462,80020-Aug-201001:06x64
Mfc90fra.dll9.0.30729.505462,80020-Aug-201002:59x86
Mfc90ita.dll9.0.30729.505461,26420-Aug-201001:06x64
Mfc90ita.dll9.0.30729.505461,26420-Aug-201002:59x86
Mfc90jpn.dll9.0.30729.505443,34420-Aug-201001:06x64
Mfc90jpn.dll9.0.30729.505443,34420-Aug-201002:59x86
Mfc90kor.dll9.0.30729.505442,83220-Aug-201001:06x64
Mfc90kor.dll9.0.30729.505442,83220-Aug-201002:59x86
Mfc90rus.dll9.0.30729.505459,72820-Aug-201001:06x64
Mfc90rus.dll9.0.30729.505459,72820-Aug-201002:59x86
Mfc90u.dll9.0.30729.50545,102,40820-Aug-201001:06x64
Mfc90u.dll9.0.30729.50543,780,42420-Aug-201002:59x86
Mfc90ud.dll9.0.30729.50547,463,24820-Aug-201001:06x64
Mfc90ud.dll9.0.30729.50545,979,47220-Aug-201002:59x86
Mfcm90.dll9.0.30729.505467,07220-Aug-201001:06x64
Mfcm90.dll9.0.30729.505459,90420-Aug-201003:00x86
Mfcm90d.dll9.0.30729.505493,18420-Aug-201001:06x64
Mfcm90d.dll9.0.30729.505480,89620-Aug-201003:00x86
Mfcm90u.dll9.0.30729.505467,07220-Aug-201001:06x64
Mfcm90u.dll9.0.30729.505459,90420-Aug-201003:00x86
Mfcm90ud.dll9.0.30729.505493,69620-Aug-201001:06x64
Mfcm90ud.dll9.0.30729.505480,89620-Aug-201003:00x86
Mfcmifc80u.dll9.0.30729.505413,13620-Aug-201023:00x86
Microsoft.visualc.stlclr.dll9.0.30729.505447,98420-Aug-201023:00x86
Msvcm90.dll9.0.30729.5054245,76020-Aug-201001:06x64
Msvcm90.dll9.0.30729.5054324,09620-Aug-201001:15IA-64
Msvcm90.dll9.0.30729.5054225,28020-Aug-201003:00x86
Msvcm90d.dll9.0.30729.5054333,31220-Aug-201001:06x64
Msvcm90d.dll9.0.30729.5054429,56820-Aug-201001:15IA-64
Msvcm90d.dll9.0.30729.5054312,83220-Aug-201003:00x86
Msvcp90.dll9.0.30729.5054853,32820-Aug-201001:06x64
Msvcp90.dll9.0.30729.50541,466,19220-Aug-201001:15IA-64
Msvcp90.dll9.0.30729.5054569,68020-Aug-201002:59x86
Msvcp90d.dll9.0.30729.50541,120,59220-Aug-201001:06x64
Msvcp90d.dll9.0.30729.50542,515,28020-Aug-201001:15IA-64
Msvcp90d.dll9.0.30729.5054871,76020-Aug-201002:59x86
Msvcr90.dll9.0.30729.5054624,46420-Aug-201001:06x64
Msvcr90.dll9.0.30729.50541,505,61620-Aug-201001:15IA-64
Msvcr90.dll9.0.30729.5054653,13620-Aug-201002:59x86
Msvcr90d.dll9.0.30729.50541,350,48020-Aug-201001:06x64
Msvcr90d.dll9.0.30729.50543,603,28020-Aug-201001:15IA-64
Msvcr90d.dll9.0.30729.50541,178,44820-Aug-201002:59x86
Vcomp90.dll9.0.30729.505456,65620-Aug-201001:06x64
Vcomp90.dll9.0.30729.5054141,64820-Aug-201001:15IA-64
Vcomp90.dll9.0.30729.505451,02420-Aug-201002:59x86
Vcomp90d.dll9.0.30729.5054104,78420-Aug-201001:06x64
Vcomp90d.dll9.0.30729.5054316,24020-Aug-201001:15IA-64
Vcomp90d.dll9.0.30729.505488,40020-Aug-201002:59x86
Vcomp90ui.dll9.0.30729.505410,57620-Aug-201023:00x86
Vcredist_ia64.exe9.0.30729.45704,656,47220-Aug-201008:12IA-64
Vcredist_x64.exe9.0.30729.45705,199,70420-Aug-201007:55x64
Vcredist_x86.exe9.0.30729.45704,483,92820-Aug-201008:23x86

状态


Microsoft 已经确认这是“适用于”一节中列出的 Microsoft 产品中的问题。