470,596 Members | 1,326 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

Memory management in Debug/Release environments

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
2 2187
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
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.

Similar topics

reply views Thread by Stefan Seefeld | last post: by
2 posts views Thread by DANIEL BEAULIEU J | last post: by
9 posts views Thread by Rafael Charnovscki | last post: by
1 post views Thread by Rob Nicholson | last post: by
4 posts views Thread by cesar.ortiz | last post: by
6 posts views Thread by Andrew Rowley | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.