Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Nov 14, 2019 2:22 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Window Method size limit?
PostPosted: Mon Jan 28, 2013 6:24 pm 
Offline
User avatar

Joined: Sat Jun 04, 2011 8:29 am
Posts: 387
Is there some limit on the number of lines in a Method?

Or size in kb or something?

I have one method that is rather long... I added an additional 3 lines of if logic code... nothing that causes pop ups or any file access or anything but if logic and setting a variable.

If I include these extra lines, Real Studio crashing when it gets to that window in the compile process.

Trying to figure out what might be causing this... if there is a limit, ideas to get around it.

-Tim

_________________
Currently using:
Windows XP Pro SP3
Real Studio 2011 Release 4.3 Enterprise
and
Mac OS 10.7.4
Real Studio 2011 Release 4.3 Enterprise
(finally also compiled on Mac)


Top
 Profile  
Reply with quote  
 Post subject: Re: Window Method size limit?
PostPosted: Tue Jan 29, 2013 10:00 am 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
Not that I'm aware of. I've never ran into such a problem, and it sounds more like something got corrupt in the method.

Are we talking hundreds or thousands of lines? Generally I don't allow a single method to exceed 200ish (and I rarely get this big) lines, but prefer to break apart sections into new methods for readability and organization.

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: Window Method size limit?
PostPosted: Tue Jan 29, 2013 10:31 am 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
torrid wrote:
Is there some limit on the number of lines in a Method?

Realistically no but you have to realize that every assignment etc _may_ create a temporary variable and that you can run out of stack space by having a really long method

Why would you not split it into a few methods that your one big one can call ?
That seems a lot more maintainable anyways

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Window Method size limit?
PostPosted: Wed Jan 30, 2013 1:27 pm 
Offline

Joined: Wed Feb 04, 2009 1:43 pm
Posts: 427
I mentioned this a long time ago.
If you have a lot of lines in a method it crashes RS during compiling! I had this in the past a few times.

Learned to live with it though.


Top
 Profile  
Reply with quote  
 Post subject: Re: Window Method size limit?
PostPosted: Wed Jan 30, 2013 6:29 pm 
Offline
User avatar

Joined: Sat Jun 04, 2011 8:29 am
Posts: 387
RS support says that there IS indeed a limit.... but not specific to any number of lines or anything that you can look for... but the compiler can hit this problem.

I had it so that if I add one line it crashed... it's not the line either... tried different ones.

Anyway broke out some code into separate method and got passed it.


Top
 Profile  
Reply with quote  
 Post subject: Re: Window Method size limit?
PostPosted: Wed Jan 30, 2013 6:34 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
I would argue (strongly) that a method that big should most definitely be broken into smaller chunks. Error handling is easier and troubleshooting/debugging is easier too, IMO.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Window Method size limit?
PostPosted: Wed Jan 30, 2013 7:42 pm 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
I ran into that sometime ago... 32k was the limit then
Lennox


Top
 Profile  
Reply with quote  
 Post subject: Re: Window Method size limit?
PostPosted: Mon Feb 04, 2013 3:03 pm 
Offline
Site Admin
User avatar

Joined: Fri Sep 30, 2005 9:35 am
Posts: 987
Location: South Portland, Maine
If memory serves, there is a limit on the stack size allocated to each method. It may have been around 32KB or so.

This does not correlate with the length of a method as far as code length. The stack is used to store variable declarations and such from what I remember.

Regardless, if you are running into an issue with this then that just means it's time to refactor your long method into 2 or more smaller ones.

_________________
Paul Lefebvre
Developer Evangelist
Xojo, Inc.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group