473,756 Members | 4,511 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory management in Debug/Release environments

Hello,

I have a problem where an application I am working on throws an
OutOfMemoryExce ption when I run it in Release mode, whereas it doesn't do
this when I am running in Debug.

The application is developed using C++/Managed C++ and built using VS 2003
under .NET framework 1.1.

In Debug, it uses of up to 600Mb of memory, whereas in Release it only gets
to use about 200Mb before throwing the Exception.

I've attempted to debug the Release version (by building it so that it
outputs symbols and attaching), and it appears that the application throws
the exception when it attempts to instantiate a .NET class using new. (The
managed C++ code calls a function from a library written in C# which then
attempts to do the instantiation.)

Is there any reason why the application should behave differently
Debug/Release environment with respect to memory management? Is there
setting I can change to get the Release version to use more memory before it
complains of an out-of-memory error?

If there's any further information you need me to supply, I'd be happy to do
so.

Thanks in advance,

--
Akin

(aknak at aksoto dot idps dot co dot uk)
Oct 5 '06 #1
2 2376
I've had experience with programs which would run fine on a Debug
version, but would crash in a Release version.

I noticed that there is something different about the way local
variables are initialized in the debug and release versions (or the
return value of a function that does not return anything under certain
conditions). I found that the crashes happened because I used certain
variables without initializing them.

Hope this helps.
Vijay.

Epetruk wrote:
Hello,

I have a problem where an application I am working on throws an
OutOfMemoryExce ption when I run it in Release mode, whereas it doesn't do
this when I am running in Debug.

The application is developed using C++/Managed C++ and built using VS 2003
under .NET framework 1.1.

In Debug, it uses of up to 600Mb of memory, whereas in Release it only gets
to use about 200Mb before throwing the Exception.

I've attempted to debug the Release version (by building it so that it
outputs symbols and attaching), and it appears that the application throws
the exception when it attempts to instantiate a .NET class using new. (The
managed C++ code calls a function from a library written in C# which then
attempts to do the instantiation.)

Is there any reason why the application should behave differently
Debug/Release environment with respect to memory management? Is there
setting I can change to get the Release version to use more memory before it
complains of an out-of-memory error?

If there's any further information you need me to supply, I'd be happy to do
so.

Thanks in advance,

--
Akin

(aknak at aksoto dot idps dot co dot uk)
Oct 6 '06 #2
Loy
Sound reasonable - release build optimize out initialization code -
esspecially in unmanaged code.

(While debug build usually even clear the memory of byte arrays when
they are allocated)

Vijay point - seem correct

Vijay wrote:
I've had experience with programs which would run fine on a Debug
version, but would crash in a Release version.

I noticed that there is something different about the way local
variables are initialized in the debug and release versions (or the
return value of a function that does not return anything under certain
conditions). I found that the crashes happened because I used certain
variables without initializing them.

Hope this helps.
Vijay.

Epetruk wrote:
Hello,

I have a problem where an application I am working on throws an
OutOfMemoryExce ption when I run it in Release mode, whereas it doesn't do
this when I am running in Debug.

The application is developed using C++/Managed C++ and built using VS 2003
under .NET framework 1.1.

In Debug, it uses of up to 600Mb of memory, whereas in Release it only gets
to use about 200Mb before throwing the Exception.

I've attempted to debug the Release version (by building it so that it
outputs symbols and attaching), and it appears that the application throws
the exception when it attempts to instantiate a .NET class using new. (The
managed C++ code calls a function from a library written in C# which then
attempts to do the instantiation.)

Is there any reason why the application should behave differently
Debug/Release environment with respect to memory management? Is there
setting I can change to get the Release version to use more memory before it
complains of an out-of-memory error?

If there's any further information you need me to supply, I'd be happy to do
so.

Thanks in advance,

--
Akin

(aknak at aksoto dot idps dot co dot uk)
Oct 8 '06 #3

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

Similar topics

0
1283
by: Stefan Seefeld | last post by:
hi there, I'm writing some C python extension and I'd like to debug the memory management, i.e. run some tests to see whether I did the ref counting correctly, etc. What's the suggested way to do that via the C API ? Is there some function which I could call at the very end of an application that will collect some
2
1966
by: DANIEL BEAULIEU J | last post by:
Basically i am a student taking an operating systems course which is c++ intensive. Familiar with Java, and so not so familiar with memory management. Looking for suggestions of exercises or web resources to help me become familiar with pointers and referencing etc. Thank you.
9
2018
by: Rafael Charnovscki | last post by:
I can comprehend the basics of that subject (pointers, memory allocation, heap, stack etc), but I am interested to have references with more details. I have some C/C++ books and lots of URLs "bookmarked", but all of them don't go too far on memory management as I would like. One of my main issues is whether function "main" and its local variables are allocated on the stack area as other functions. Does anybody recommend a good book or...
2
3958
by: Scott Yost | last post by:
I reference a .NET DLL to import some of my custom types. I can build that DLL in debug or release mode, but I usually keep the debug one built so I can debug it. When I want to link to the release version of the DLL, I find that I have to remove the reference from the project and point VS. NET to the release version of the DLL. Is there some way to do this automatically, like it usually done in the past, so that the release/debug switch...
1
1710
by: Rob Nicholson | last post by:
We're developing our first large scale ASP.NET web application and I'm a little concerned over memory usage of aspnet_wp.exe on the development server during testing. The application appears to use a lot of memory and I've got the feeling that it's not all been released. Some initial questions: When a session times out, is ASP.NET/CLR supposed to release every resource allocated during the session?
8
9334
by: Chad | last post by:
hello, i am losing memory each time i make this call to a C++ dll (I make frequent calls). 'in VB.Net Declare Function grab Lib "grabber.dll" _ (ByRef lpBuf As Byte, ByVal lnum As Integer) As Integer the C++ function is...
4
1816
by: cesar.ortiz | last post by:
Hi, I am starting to have a look to a python program that does not free memory (I am using python 2.4.3). As I have read about a new memory management in python 2.5 (http://evanjones.ca/python-memory.html) I decided to try the program with the new version. With the new version of python the memory consumption is the same. Now I am asking myself if python 2.5 has any improving in memory management or maybe not yet. Thank you. -- Cesar
6
9142
by: Andrew Rowley | last post by:
I am having trouble getting debug and release builds to work properly with project references using C++ .NET and Visual Studio 2003. I created a test solution, with a basic Windows form C++ project. I then add a class library, and add a reference to this project in the first project. When I do a release build, I see the following in the output from the DLL compile: /OUT:"C:\Documents and Settings\Andrew\My Documents\Visual Studio
7
1610
by: Joey | last post by:
VS2005 asp.net 2.0 C# Developing with File System/Cassini instead of IIS (publish to IIS every so often) Hello guys, I have a web app where I am using static variables on many pages to maintain values between postbacks. I am also using several static
0
9271
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,...
0
10031
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, 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...
1
9838
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9708
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8709
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, 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...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.