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

Memory management in Debug/Release environments

P: n/a
Hello,

I have a problem where an application I am working on throws an
OutOfMemoryException 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
Share this Question
Share on Google+
2 Replies


P: n/a
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
OutOfMemoryException 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

P: n/a
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
OutOfMemoryException 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 discussion thread is closed

Replies have been disabled for this discussion.