Symptoms

Consider the following scenarios.

Scenario 1

  • You run a Microsoft Foundation Class (MFC) application that is developed in Microsoft Visual Studio 2010 Service Pack 1 (SP1).

  • The MFC application uses Portable Network Graphics (PNG) images as resources by repeatedly calling the internal CPngImage::LoadFromBuffer method.

Scenario 2

  • You run an MFC application that is developed in Microsoft Visual Studio 2010 SP1.

  • The MFC application calls the CMFCRibbonBar class to implement ribbon bars.

    NoteThe CMFCRibbonBar class for ribbon bars calls the CPngImage::LoadFromBuffer method.

  • The ribbon bars contain categories and buttons that use PNG images as resources.

  • You repeatedly open and close a document that has customized ribbon bars.

In these scenarios, a memory leak occurs in the MFC application. Therefore, the memory usage of the application increases.

Cause

This issue occurs because memory is not freed. This memory is allocated by the CreateStreamOnHGlobal function in the CPngImage::LoadFromBuffer method.

Note The expected behavior is that the memory is freed after a stream is released. This stream is created by the CreateStreamOnHGlobal function.

Resolution


Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:

http://support.microsoft.com/contactus/?ws=supportNote In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

To apply this hotfix, you must have Visual Studio 2010 SP1 installed.

Restart requirement

You may have to restart the computer after you install this hotfix if the affected files are being used.

File information

The global version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

For all supported x86-based versions of Microsoft Visual C++ 2010 SP1 Redistributable Package

File name

File version

File size

Date

Time

Platform

Atl100.dll

10.0.40219.332

138,056

11-Jul-2011

10:57

x86

Mfc100.dll

10.0.40219.332

4,397,384

11-Jul-2011

10:57

x86

Mfc100chs.dll

10.0.40219.332

36,176

11-Jul-2011

10:57

x86

Mfc100cht.dll

10.0.40219.332

36,176

11-Jul-2011

10:57

x86

Mfc100deu.dll

10.0.40219.332

64,336

11-Jul-2011

10:57

x86

Mfc100enu.dll

10.0.40219.332

55,120

11-Jul-2011

10:57

x86

Mfc100esn.dll

10.0.40219.332

63,824

11-Jul-2011

10:57

x86

Mfc100fra.dll

10.0.40219.332

64,336

11-Jul-2011

10:57

x86

Mfc100ita.dll

10.0.40219.332

62,288

11-Jul-2011

10:57

x86

Mfc100jpn.dll

10.0.40219.332

43,856

11-Jul-2011

10:57

x86

Mfc100kor.dll

10.0.40219.332

43,344

11-Jul-2011

10:57

x86

Mfc100rus.dll

10.0.40219.332

60,752

11-Jul-2011

10:57

x86

Mfc100u.dll

10.0.40219.332

4,422,992

11-Jul-2011

10:57

x86

Mfcm100.dll

10.0.40219.332

81,744

11-Jul-2011

10:57

x86

Mfcm100u.dll

10.0.40219.332

81,744

11-Jul-2011

10:57

x86

Msvcp100.dll

10.0.40219.332

421,200

11-Jul-2011

10:57

x86

Msvcr100_clr0400.dll

10.0.40219.332

773,968

11-Jul-2011

10:57

x86

Vcomp100.dll

10.0.40219.332

51,024

11-Jul-2011

10:57

x86

For all supported x64-based versions of Microsoft Visual C++ 2010 SP1 Redistributable Package

File name

File version

File size

Date

Time

Platform

Atl100.dll

10.0.40219.332

158,536

11-Jul-2011

10:14

x64

Mfc100.dll

10.0.40219.332

5,574,984

11-Jul-2011

10:14

x64

Mfc100chs.dll

10.0.40219.332

36,176

11-Jul-2011

10:14

x64

Mfc100cht.dll

10.0.40219.332

36,176

11-Jul-2011

10:14

x64

Mfc100deu.dll

10.0.40219.332

64,336

11-Jul-2011

10:14

x64

Mfc100enu.dll

10.0.40219.332

55,120

11-Jul-2011

10:14

x64

Mfc100esn.dll

10.0.40219.332

63,824

11-Jul-2011

10:14

x64

Mfc100fra.dll

10.0.40219.332

64,336

11-Jul-2011

10:14

x64

Mfc100ita.dll

10.0.40219.332

62,288

11-Jul-2011

10:14

x64

Mfc100jpn.dll

10.0.40219.332

43,856

11-Jul-2011

10:14

x64

Mfc100kor.dll

10.0.40219.332

43,344

11-Jul-2011

10:14

x64

Mfc100rus.dll

10.0.40219.332

60,752

11-Jul-2011

10:14

x64

Mfc100u.dll

10.0.40219.332

5,601,616

11-Jul-2011

10:14

x64

Mfcm100.dll

10.0.40219.332

93,008

11-Jul-2011

10:14

x64

Mfcm100u.dll

10.0.40219.332

93,008

11-Jul-2011

10:14

x64

Msvcp100.dll

10.0.40219.332

608,080

11-Jul-2011

10:14

x64

Msvcr100_clr0400.dll

10.0.40219.332

829,264

11-Jul-2011

10:14

x64

Vcomp100.dll

10.0.40219.332

57,168

11-Jul-2011

10:14

x64

For all supported IA-64–based versions of Visual C++ 2010 SP1 Redistributable Package

File name

File version

File size

Date

Time

Platform

Atl100.dll

10.0.40219.332

385,352

11-Jul-2011

10:37

IA-64

Msvcp100.dll

10.0.40219.332

966,480

11-Jul-2011

10:37

IA-64

Msvcr100_clr0400.dll

10.0.40219.332

1,499,472

11-Jul-2011

10:37

IA-64

Vcomp100.dll

10.0.40219.332

143,184

11-Jul-2011

10:37

IA-64


More Information


For more information about this issue in Microsoft Visual Studio 2008, click the following article number to view the article in the Microsoft Knowledge Base:

982637 A memory leak occurs in an MFC application that is developed by using Visual Studio 2008 SP1 when the CPngImage::LoadFromBuffer method is used

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×