473,473 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Managed VC++ crashing in debug build caused memory leaks

PL
Hi everyone,
I was surprised to see memory leaks in our application when it crashed
today. Basically, the code is written in C#, but with c# and C++ DLLS;
its the latter (managed extensions) that cause the memory leaks (the new
operator in crtdbg.h). Does the garbage collector not work in debug build
for VC++?

TIA

Paul

--
----
Home: http://www.paullee.com
Woes: http://www.dr_paul_lee.btinternet.co.uk/auto.shtml
Nov 14 '06 #1
4 1109
PL
By the way, this is using .NET framework 1.1 - we can't upgrade to 2 yet!

PL wrote:
Hi everyone,
I was surprised to see memory leaks in our application when it crashed
today. Basically, the code is written in C#, but with c# and C++ DLLS;
its the latter (managed extensions) that cause the memory leaks (the new
operator in crtdbg.h). Does the garbage collector not work in debug build
for VC++?

TIA

Paul
--
----
Home: http://www.paullee.com
Woes: http://www.dr_paul_lee.btinternet.co.uk/auto.shtml
Nov 14 '06 #2

"PL" <pa**@NO.NO.NO.paulSPAMlee.comwrote in message
news:TK******************************@bt.com...
By the way, this is using .NET framework 1.1 - we can't upgrade to 2 yet!

PL wrote:
>Hi everyone,
I was surprised to see memory leaks in our application when it crashed
today. Basically, the code is written in C#, but with c# and C++ DLLS;
its the latter (managed extensions) that cause the memory leaks (the new
operator in crtdbg.h). Does the garbage collector not work in debug build
for VC++?
Remember that only __gc objects are garbage collected, and the new operator
can also allocate from the native heap. This is distinguished a lot better
in C++/CLI, but you said you're stuck with .NET 1.1 :(
>>
TIA

Paul

--
----
Home: http://www.paullee.com
Woes: http://www.dr_paul_lee.btinternet.co.uk/auto.shtml

Nov 14 '06 #3
PL
Ben Voigt wrote:
>
"PL" <pa**@NO.NO.NO.paulSPAMlee.comwrote in message
news:TK******************************@bt.com...
>By the way, this is using .NET framework 1.1 - we can't upgrade to 2 yet!

PL wrote:
>>Hi everyone,
I was surprised to see memory leaks in our application when it crashed
today. Basically, the code is written in C#, but with c# and C++ DLLS;
its the latter (managed extensions) that cause the memory leaks (the new
operator in crtdbg.h). Does the garbage collector not work in debug
build for VC++?

Remember that only __gc objects are garbage collected, and the new
operator
can also allocate from the native heap. This is distinguished a lot
better in C++/CLI, but you said you're stuck with .NET 1.1 :(
Thanks! However, it looks like all objects are declared using __gc, so maybe
the memory leaks are an artefact of compiling in debug mode only?
Nov 14 '06 #4
PL
It looks like all the dynamically allocated objects are decorated
with the gc moniker. I don't like to contemplate this, but does the
CLR/garbage collector not work properly in debug build?
----
Home: http://www.paullee.com
Woes: http://www.dr_paul_lee.btinternet.co.uk/auto.shtml
Nov 20 '06 #5

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

Similar topics

0
by: Scott Chang | last post by:
Hi all, I tried to use Managed C++ coding of VC++.NET (2002)and OpenGL version 1.2 to draw a hexagon shape of benzene. My OpenGLdrawBenzene.cpp is the following: // This is the main project file...
1
by: Eric Twietmeyer | last post by:
Hello, I'm starting to investigate cs, managed c++ and interoperating with a very large unmanaged code base. We are going to use Windows Forms (written in cs) to replace our old fashioned GUI. ...
12
by: Rob C | last post by:
Are there any good papers/documentation around for taking an unmanaged VC++ Project using MFC (created in VC V6) and making it managed? My main goal here to be able to implement new functionality...
0
by: Frank Lopez | last post by:
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...
8
by: Daniel Yelland | last post by:
Hi, I have developed a number of code libraries in Win32 DLLs and have written a number of test suite executables that implicitly link to these libraries in order to test them. In one of my test...
4
by: Dan Diephouse | last post by:
I am attempting to write a DLL which wraps C# code. The issue at hand is a print driver allows you to extend it by writing a DLL. Seeing that VC++ seems to be hopelessly out of my mental reach, I...
23
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
3
by: Noah | last post by:
On May 6, 6:27 am, David <wizza...@gmail.comwrote: You need to use the debug build of Python to get exact numbers, but there are a few tricks you can use with the standard build to detect memory...
4
by: =?Utf-8?B?dmlwZXJ4MTk2Nw==?= | last post by:
We are having an issue with an application we are developing. We have a Legacy COM DLL in C++ that we have converted to Visual Studio 2008. This COM DLL has methods that are calling Managed C#...
0
marktang
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,...
0
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...
0
Oralloy
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.