473,735 Members | 2,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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(10 2)
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
Newsgroups: microsoft.publi c.dotnet.langua ges.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

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

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:OCfpGbzcCH A.2380@tkmsftng p11...
// 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(10 2) : {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). =============== =============== ============

Nov 17 '05 #1
0 3905

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular expression. I have done a GC.Collect to make sure that, no memory is lying around. GC reports only 84k of allocations. Starting 5-10 of this apps is going to start taking a considerable amount of memory. Is there a way to reduce this? Tom
by: Adam McKee | last post by:
We are using Visual Studio.NET 2003 in our project with .NET framework 1.1. One of our libraries is a mixed-mode dll assembly consisting of one managed C++ library, and several unmanaged C++ libraries. We are using managed C++ as a bridge between managed .NET code and unmanaged C++ code, which I'm sure is a fairly common practice. The managed C++ library is compiled with /CLR whereas all other libraries are compiled without /CLR because...
by: Frank Lopez | last post by:
My program structure is: 1. 2. 3. => manually does the crt-init and crt-terminate calls 4. -- this is accessed by the unmanaged C++ classes in (3) using LoadLibrary and FreeLibrary
by: mircu | last post by:
Hi, I need a tool to check my applicationm for memory leaks. It uses mixed code and for now I didn't find proper tool. My application is managed c++ app and it uses mc++ wrappers for my unmanaged code (which uses MFC). When I stop debugging there is info about memory leaks but I'm sure that every wrappers deletes unmanaged objects in finalizers. So maybe the finalizers aren't called? Is there a tool which could show me leaked objects in...
by: Nadav | last post by:
Hi, I am writing a performence critical application, this require me to stick to unmanaged C++ as performance is much better using unmanaged C++ ( about 33% better ), Still, I am trying to avoid the usage of old style COM, my alternative is to expose my unmanaged interface through the CLI, to achieve that I have created a mixed mode DLL in which my unmanaged class are defined. When referencing the DLL just described in another mixed mode EXE...
by: Chetan Raj | last post by:
Hi All, We have a web-application in asp.net that interacts with legacy code written in COM. The memory usage in aspnet_wp.exe increases every sec and never reduces. Using the .NET performance counters, we found that unmanaged memory was 90% of the total private bytes of aspnet_wp.exe. We suspected that the COM code has memory leaks. So we made it as a COM+ Service running as dllhost.exe. Surprisingly, there was no memory increase in...
by: James Hunter Ross | last post by:
Friends, I've been watching or W3WP process size (using Task Manager), and it grows and grows when using our application. I am the only one on our server. I'll end my session, either through timeout or logout, and the process size never goes down. I could understand that if the next time I logged in the size didn't change, implying that the process was big but had "headroom". But, things start growing again. I guess that we have...
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
by: Mali Guven | last post by:
Hello, I have a native DLL (written in C) which is supposed to call a managed DLL (was written in C#, and an entry point was injected modifying the ildasm'd code). The exectuable calls the native DLL but the native DLL fails to load the managed DLL. The paper that addresses the 'mixed DLL problem' below does not offer any understandable workaround....
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.