replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Stack OverflowException
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Stack OverflowException

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Wed Jan 05, 2005 4:05 pm    Post subject: Stack OverflowException Reply with quote

I am attempting to call a fortran subroutine (in a .NET DLL) from a c# front end.

The fortran code works fine from within the Plato3 IDE on its own. But Visual studio gives a
"An unhandled exception of type 'System.StackOverflowException' occurred in Fortranbackend.dll"

I have shrunk the fortran subroutine down to following

SUBROUTINE LoadTest

REAL*8 HC(65341),HS(65341),CC(65341),CS(65341)


END SUBROUTINE

If I remove the above line and replace with smaller variable declarations, all is OK

This cannot be called from c# in Visual Studio Enterprise, but works fine in Plato 3 IDE.

Any Ideas what params I have to tweek in VS to be able to call my code.

Thanks

Mike
Back to top
Mike



Joined: 05 Jan 2005
Posts: 4

PostPosted: Thu Jan 06, 2005 2:02 am    Post subject: Stack OverflowException Reply with quote

Just wanted to add my proper forums ID, now I have signed up (Previous message was posted before I joined the forums)

Thanks
Back to top
View user's profile Send private message
silverfrost
Site Admin


Joined: 29 Nov 2006
Posts: 191
Location: Manchester

PostPosted: Thu Jan 06, 2005 10:59 am    Post subject: Stack OverflowException Reply with quote

The problem is that as the exception indicates you do not have enough stack space. Your arrays are taking 65341*8*4 bytes (2090912 bytes). I suspect your c# application has a smaller stack space limit than this -- from memory 1MB. You could try making the variables not stack based (i.e. make then common or in a module). Not sure if C# can increase the stack space.

------------
Administrator
Silverfrost Forums
Back to top
View user's profile Send private message Visit poster's website
Mike



Joined: 05 Jan 2005
Posts: 4

PostPosted: Thu Jan 06, 2005 3:48 pm    Post subject: Stack OverflowException Reply with quote

Thanks for response. Dont really want to change the size of the arrays or re-jig the software, really need to use it as-is. However a bit of a crawl around the net and I found that you can re-size the stack size of the apps by using the

[big]EDITBIN.EXE /STACK:nnnnnnnn[/big] Utility.

Worked a treat. Smile
Back to top
View user's profile Send private message
silverfrost
Site Admin


Joined: 29 Nov 2006
Posts: 191
Location: Manchester

PostPosted: Thu Jan 06, 2005 5:13 pm    Post subject: Stack OverflowException Reply with quote

Excellent solution

------------
Administrator
Silverfrost Forums
Back to top
View user's profile Send private message Visit poster's website
criga



Joined: 08 Sep 2005
Posts: 1

PostPosted: Thu Sep 08, 2005 10:31 am    Post subject: Stack OverflowException Reply with quote


Hi Admin,

you say "making the variables not stack based (i.e. make then common or in a module)".

How would you do that? Can you give an example or point to a reference ... I have the same problem with

parameter(maxne=45000,maxnn=25000,maxnz=30,maxnez=maxnz-1,
+ maxw=1000,maxpw=32,maxpt=2000,maxmk=10)

Thanks, Chris.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group