www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Debug OutOfMemoryError?

reply Jacob Carlborg <doob me.com> writes:
How do I debug an OutOfMemoryError? I'm trying to run a simple 
application that uses SDL and OpenGL with Derelict on Mac OS X 10.6. It 
works fine using D1 and Tango but fails with the message "Memory 
allocation failed" when I use D2. I probably messed something up when I 
ported the Mac specific parts of Derelict SDL to make it work with D2. 
But how do I debug it when it just prints "Memory allocation failed" and 
exits with code 01? I can't catch the exception and even if I could it 
would be useless because it doesn't contain any stack trace, what it 
looks like after looking at the druntime source code.

Any advise?

-- 
/Jacob Carlborg
Jul 31 2010
parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Sat, 31 Jul 2010 05:55:40 -0400, Jacob Carlborg <doob me.com> wrote:

 How do I debug an OutOfMemoryError? I'm trying to run a simple  
 application that uses SDL and OpenGL with Derelict on Mac OS X 10.6. It  
 works fine using D1 and Tango but fails with the message "Memory  
 allocation failed" when I use D2. I probably messed something up when I  
 ported the Mac specific parts of Derelict SDL to make it work with D2.  
 But how do I debug it when it just prints "Memory allocation failed" and  
 exits with code 01? I can't catch the exception and even if I could it  
 would be useless because it doesn't contain any stack trace, what it  
 looks like after looking at the druntime source code.

 Any advise?

Try compiling druntime in debug mode with -gc, then debug the application, putting a breakpoint at the point where it prints the error. -Steve
Aug 02 2010
parent Jacob Carlborg <doob me.com> writes:
On 2010-08-02 14:34, Steven Schveighoffer wrote:
 On Sat, 31 Jul 2010 05:55:40 -0400, Jacob Carlborg <doob me.com> wrote:

 How do I debug an OutOfMemoryError? I'm trying to run a simple
 application that uses SDL and OpenGL with Derelict on Mac OS X 10.6.
 It works fine using D1 and Tango but fails with the message "Memory
 allocation failed" when I use D2. I probably messed something up when
 I ported the Mac specific parts of Derelict SDL to make it work with
 D2. But how do I debug it when it just prints "Memory allocation
 failed" and exits with code 01? I can't catch the exception and even
 if I could it would be useless because it doesn't contain any stack
 trace, what it looks like after looking at the druntime source code.

 Any advise?

Try compiling druntime in debug mode with -gc, then debug the application, putting a breakpoint at the point where it prints the error. -Steve

I'll give that a try, thanks. -- /Jacob Carlborg
Aug 02 2010