Help with debugging code

P

pauldepstein

I am writing code to price some financial options using recursive
functions.

It compiles but I get a runtime error which is caused by a memory
violation.

The problem is that the code is much too long to be suitable for
inclusion in this posting, and I don't know where the problem lies.

If anyone does have the time/willingness/extreme kindness to help me, I
would think that the simplest thing would be for them to get in touch
with me at (e-mail address removed)

I can be reached by yahoo IM also. My yahoo ID is pauldepstein.

If anyone feels they could help me but only on a paid basis, please let
me know and we'll try and work something out.

Thank you,

Paul Epstein
 
P

pauldepstein

I am writing code to price some financial options using recursive
functions.

It compiles but I get a runtime error which is caused by a memory
violation.

The problem is that the code is much too long to be suitable for
inclusion in this posting, and I don't know where the problem lies.

If anyone does have the time/willingness/extreme kindness to help me, I
would think that the simplest thing would be for them to get in touch
with me at (e-mail address removed)

I can be reached by yahoo IM also. My yahoo ID is pauldepstein.

If anyone feels they could help me but only on a paid basis, please let
me know and we'll try and work something out.

Thank you,

Paul Epstein

Sorry. On rereading the above posting, I see that readers would have
to go through an unnecessary second process to obtain my email address.

My email address is pauldepstein at yahoo dot com

Thanks again for your help and support.

Paul Epstein
 
M

mlimber

I am writing code to price some financial options using recursive
functions.

It compiles but I get a runtime error which is caused by a memory
violation.

The problem is that the code is much too long to be suitable for
inclusion in this posting, and I don't know where the problem lies.

If anyone does have the time/willingness/extreme kindness to help me, I
would think that the simplest thing would be for them to get in touch
with me at (e-mail address removed)

I can be reached by yahoo IM also. My yahoo ID is pauldepstein.

If anyone feels they could help me but only on a paid basis, please let
me know and we'll try and work something out.

Thank you,

Paul Epstein

Have you run through the program in your debugger? Can you boil it down
to a simple but complete example that demonstrates the same problem?
See this FAQ on posting code:

http://parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

Wild guess: you're overflowing your stack because of repeated
recursion. Try enlarging the stack size (perhaps in the project
settings if you're using an IDE, or maybe via a command line tool in
some flavor of unix).

Cheers! --M
 
P

pauldepstein

mlimber said:
Have you run through the program in your debugger? Can you boil it down
to a simple but complete example that demonstrates the same problem?
See this FAQ on posting code:

http://parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

Wild guess: you're overflowing your stack because of repeated
recursion. Try enlarging the stack size (perhaps in the project
settings if you're using an IDE, or maybe via a command line tool in
some flavor of unix).

Cheers! --M

Thank you, M limber!

I think your "wild guess" is probably correct. Here is more info on
the code: I set a variable J using a function which is a member of the
parameters class.

I then access J in several places and inside recursive functions using
the line: int J = params_ptr->get_int("J");

if (!strncmp (in_string, "J", 100)) {return J; } is part of the
get_int function.

This accessing of J seems to work going through the loop a few times
but not on the sixth.

So your "guess" is very helpful.

I am very much a newbie and have no idea how to enlarge the stack size.

The IDE is dev c++. Of course, I would be happy to research the topic
of stack-size-enlarging-using-Dev-c++ independently. (I will google it
immediately after this posting.) I merely mention my ignorance of
this, by way of reply to your advice.

Thank you,

Paul Epstein
 
B

Ben Pope

Wild guess: you're overflowing your stack because of repeated
recursion. Try enlarging the stack size (perhaps in the project
settings if you're using an IDE, or maybe via a command line tool in
some flavor of unix).

....and of course, make sure that the recursion is bounded!

We should be able to see what's wrong by seeing the declaration of the
recursive function, the initial values passed to it, and anything inside
the function that modifies any of the values passed to it.

Ben Pope
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top