By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,660 Members | 1,579 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,660 IT Pros & Developers. It's quick & easy.

Status ?: VC7++ - Detection of memory leaks, mixed DLL (unmanaged/managed)

P: n/a
Does anyone know if Microsoft generated a whitepaper on this topic?

Does anyone know what the solution is? (meaning, eliminate the leak
problem -- I am seeing three memory leaks from dllmodul.cpp(102)
similar to what is mentioned below)...

I am calling MFC as part of unmanaged code used by the managed code.

+--------

.... copied from October 2002 posts ...

From: Visual C++ Team (vc**@microsoft.com)
Subject: Re: VC7++ - Detection of memory leaks, mixed DLL
(unmanaged/managed)
Newsgroups: microsoft.public.dotnet.languages.vc
Date: 2002-10-20 20:46:02 PST

Hi Bill,
This is a known issue. We are currently working on a whitepaper that
describes the issue and several possible technical solutions. I will
post a
message to this thread when the whitepaper is made available for
download.

--
Scott Currie
Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no
rights.

Visual C++ Team wrote:
Hi Bill,
We were unable to reproduce your problem. We will contact you in a
separate email for a repro case.
"Billw" <bf******@home.com> wrote in message
news:OCfpGbzcCHA.2380@tkmsftngp11...
// Sorry, mis-posted previous message

Compile a DLL- use MFC, some cpp files w/CLR, some cpp files w/o CLR. Include an unmanaged static var that will store unmanaged allocated
objects (i.e. - CStringArray which will eventually hold allocated
CString's). The resulting DLL is a .NET assembly and, in addition,
a .lib file is produced to link with unmanaged applications.

When running an unmanaged application that uses this DLL (normal
unmanaged DLL 'lib' linkage) in the debugger, normal closure of the application will cause the memory objects stored in the static var
to be detected and reported as memory leaks.

Is there a way to configure the memory leak detection to NOT report
these objects while detecting and reporting real memory leaks?

========================================
Output window when the application is closed
========================================
The thread 'Win32 Thread' (0x468) has exited with code 0 (0x0).
Detected memory leaks!
Dumping objects ->
{177} normal block at 0x002F88F0, 28 bytes long.
Data: <( @| > 28 10 40 7C 05 00 00 00 05 00 00 00 01 00 00 00
{176} normal block at 0x002F8898, 24 bytes long.
Data: <( @| > 28 10 40 7C 03 00 00 00 03 00 00 00 01 00 00 00
array_s.cpp(150) : {175} normal block at 0x002F8848, 20 bytes long.
Data: < v/ / / > E0 76 2F 00 A8 88 2F 00 00 89 2F 00 CD CD CD CD
{174} normal block at 0x002F76D0, 24 bytes long.
Data: <( @| > 28 10 40 7C 03 00 00 00 03 00 00 00 01 00 00 00
dllmodul.cpp(102) : {68} client block at 0x002F2838, subtype c0, 64
bytes long.
a CDynLinkLibrary object at $002F2838, 64 bytes long
{63} client block at 0x002F2608, subtype c0, 64 bytes long.
a CDynLinkLibrary object at $002F2608, 64 bytes long
Object dump complete.
The program '[1672] console.exe: Native' has exited with code 0
(0x0). ==========================================
--
Billw

Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.