'Out of Stack space' is a different error than,

> trappable error "Out
> of string space," or the fatal error Out of memory.

so in this case I don't think "ebInstance_SetPublicSpace function"
is going to do anything for you.  The "cure" for this problem is
to rearrange the code.  Here's details on this error:

 ------------------------------------------------------------------
 Script returns an error, 'Out of Stack space'
 ------------------------------------------------------------------

 Most likely caused by recursion in the code.

 Rose Script has a maximum stack of 8k (which we have it set to).
 This is the maximum you can have with Summit Basic (the language
 we license in Rose). One of Rational's developers wrote to Summit
 Basic regarding this problem with another script, here is their
 reply.

 --------------------- start of mail message ---------------

 Yes, you have exceeded stack space. When you Dim a userdialog, the
 entire dialog definition is allocated on the execution stack, of
 which there is 2K by default (but you can increase to a miximum of
 8K).

 To work around the stack limitation, you need to place the dialog
 declarations into subroutines. I have modified your script to
 deminstrate and attached it.

 --------------------- end of mail message ---------------------

 The following defect was closed as NO ACTION, since this problem
 is a limitation with Summit Basic Script. Summit is planning to
 move to VBA and will not do much to resolve the stacking problem.

 ------------------------------------------------------------------
 RBU DefectID: 4275 : Script does not work when compiled
 Reason Closed __ No Action Taken
 Notes::
 This script works perfectly OK when you run it under the debugger.
 When you compile it and try to run the compiled version from the
 menu, it ceases to execute
 ***  ***  ***
 Stack space is running out.   I tested by using different values
 for the arrays, and got the script to quit earlier or later (on
 my system it stopped at the call for offsetOfPropName).   So the
 behavior is that which indicates that the program ran out of stack
 (works in debug but not compiled).   RoseScript only has 8k of
 stack space to work with.   There is not much that I can do from
 our side. Sorry.
 ------------------------------------------------------------------

 Scripts invoked using the RoseScript option on a menu or started
 by RoseApp.ExecuteScript appear to have very limited stack. The
 same scripts run in the script debugger have considerably more.
 Why is this?

 Running compiled scripts from the menu eats up more stack space then
 running source in scripting environment, which has a larger amount of
 stack space, hence it will often work when run directly but not from
 the menu. If you run the script in the debug window the bounds are not
 as tight as when running the compiled version.  Much the same as when
 running a debug version of C++ code and a release version of C++ code.
 The debug environment is not as strict at times.

 ------------------------------------------------------------------
 POSSIBLE WORKAROUNDs:
 ------------------------------------------------------------------

 1) Some Code needs to be rewritten to avoid the deep recursion in
 the program.

 2) Not a fix but a way to get further along is to increase stack
 space by running the file as a .ebs as oppossed to .ebx from
 menu. This will get you 2 or 3 times further before hitting stack
 limit as oppossed to if you run the ebx file directly.  There maybe
 some other speed issues since you are now running .ebs, but that's
 the trade off.

 3) Put parts of the script in a VB component and use it from the script.
 You may want to rearchitect the integration by extracting some
 of the logic and placing it in a COM client to Rose since this is
 the most scalable solution.

 4)
 Fully port to visual Basic
 You have the option of creating an Addin or script with VB and porting
 the Rose Script code to VB.

 ------------------------------------------------------------------
 PROBLEM EXAMPLES:
 ------------------------------------------------------------------

 1)

 Sub recurse (ByVal depth As Integer)
    Print depth
    recurse depth+1
 End Sub

 Sub Main
    viewport.open
    recurse 1
 End Sub

 runs for 359 iterations in the debugger before stopping with an out of
 stack space error.

 If started from the menu it recurses 80 times before stopping (with no
 error message). Whilst the example is trivial some of my more complex
 scripts now won't run from the menu

 ------------------------------------------------------------------

 2)

 The following script compiles and runs if executed directly (.ebs).
 Script fails to execute if compiled ebx is run.
 If ANY two lines are removed from dialog, then compiled script runs.
 Fails in both Rose 98 and Rose 98i.

'------------------------------------------------------------------

Sub Main
       Dim theCategories () As String
       Dim anyList () As String

       Begin Dialog ViewWizardDialog ,,292,225,"View Wizard"
               GroupBox 4,4,284,52,"Domain",.GroupBox1
               Text 8,16,32,8,"Package:",.ClassPackage
               DropListBox 8,24,136,80,theCategories$,.ClassPackageListBox
               Text 148,16,32,8,"Class:",.Text1
               DropListBox 148,24,136,80,anyList$,.ClassListBox
               Text 120,44,24,8,"Owner:",.Text7
               TextBox 148,40,124,12,.OwnerName
               PushButton 272,40,12,12,"<-",.CopyOwnerButton
               CheckBox 56,60,60,8,"Show inherited",.InheritedCeckBox
               Text 8,60,32,8,"Attributes:",.Text2
               ListBox 8,72,108,64,anyList$,.AttributeList
               PushButton 124,72,12,12,">>",.AllRightButton
               PushButton 124,88,12,12,">",.OneRightButton
               PushButton 124,104,12,12,"X",.OneDeleteButton
               PushButton 124,120,12,12,"XX",.AllDeleteButton
               Text 144,60,36,8,"Inclusions:",.Text3
               ListBox 144,72,108,64,anyList$,.InclusionList
               PushButton 260,72,24,14,"Up",.UpButton
               PushButton 260,88,24,14,"Down",.DownButton
               PushButton 260,104,24,14,"Edit",.EditButton
               PushButton 260,120,24,14,"New",.NewButton
               Text 8,136,20,8,"Path:",.Text8
               TextBox 28,136,224,12,.Path
               GroupBox 4,152,284,52,"View",.GroupBox2
               Text 8,164,32,8,"Package:",.Text4
               DropListBox 8,172,136,84,theCategories$,.ViewPackageListBox
               Text 148,164,32,8,"Diagram:",.Text6
               DropListBox 148,172,136,80,anyList$,.ViewDiagramListBox
               Text 8,192,24,8,"Name:",.Text5
               TextBox 32,188,112,12,.ViewName
               CheckBox 196,192,47,8,"Top view",.TopCheckBox
               OKButton 4,208,48,14,.CreateButton
               PushButton 124,208,48,14,"About",.AboutButton
               CancelButton 240,208,48,14,.CancelButton
       End Dialog

       Begin Dialog AboutDialog ,,255,264,"About View Wizard"
               CancelButton 112,248,40,14
               Text 92,4,80,16,"View Wizard",.Text1,,14,ebBold
               Text 84,20,104,8,"Rado1 Cervenka, Aitecon s.r.o.",.Text2
               Text 108,28,52,8,"[EMAIL PROTECTED]",.Text3
               Text 16,40,228,24,"The View Wizard dialog is aimed to help with
automatic creation of View Classes from the Domain Classes and placing them
into model diagrams. For more detailed description see the HML language
specification.",.Text4
               Text 8,80,72,8,"Domain / Package",.Text5,,,ebBold
               Text 8,88,72,8,"Domain / Class",.Text6,,,ebBold
               Text 8,184,72,8,"View / Package",.Text7,,,ebBold
               Text 8,192,72,8,"View / Diagram",.Text8,,,ebBold
               Text 8,200,72,8,"View / Name",.Text9,,,ebBold
               GroupBox 4,68,248,176,"Dialog Item Descriptions",.GroupBox1
               Text 8,112,72,8,"Attributes",.Text10,,,ebBold
               Text 8,144,72,8,"Inclusions",.Text11,,,ebBold
               Text 88,80,160,8,"a package containing the source domain
class",.Text12
               Text 88,88,160,8,"the source domain class",.Text13
               Text 88,112,160,8,"attributes of the source domain
class",.Text14
               Text 88,144,160,8,"inclusions being created in the target view
class",.Text15
               Text 88,184,160,8,"a package which will contain the target view
class",.Text16
               Text 88,192,160,8,"a diagram which will display the target view
class",.Text17
               Text 88,200,160,8,"a name of the target view class being
created",.Text18
               Text 8,128,72,8,">   >>",.Text19,,,ebBold
               Text 88,128,160,8,"move item(s) from attribute to inclusion
list",.Text20
               Text 8,152,72,8,"Up, Down",.Text21,,,ebBold
               Text 8,216,72,8,"OK",.Text22,,,ebBold
               Text 8,232,72,8,"Cancel",.Text24,,,ebBold
               Text 8,224,72,8,"About",.Text25,,,ebBold
               Text 88,152,160,8,"change an order of inclusions",.Text26
               Text 88,216,160,8,"create the new target view class",.Text27
               Text 88,232,160,8,"cancel the View Wizard (all actions remains
valid)",.Text29
               Text 88,224,160,8,"this window",.Text30
               Text 8,136,72,8,"X   XX",.Text31,,,ebBold
               Text 88,136,160,8,"delete inclusion(s)",.Text32
               Text 8,208,72,8,"View / Top view",.Text33,,,ebBold
               Text 88,208,160,8,"top view indicator",.Text34
               Text 8,120,72,8,"Show inherited",.Text23,,,ebBold
               Text 88,120,160,8,"dispaly also inherited attributes",.Text28
               Text 8,160,72,8,"Edit",.Text35,,,ebBold
               Text 8,168,72,8,"New",.Text36,,,ebBold
               Text 8,176,72,8,"Path",.Text37,,,ebBold
               Text 88,160,160,8,"edit an existing inclusion",.Text38
               Text 88,168,160,8,"add new inclusion",.Text39
               Text 88,176,160,8,"navig. path of  inclusions created from
attributes",.Text40
               Text 8,104,72,8,"<-",.Text41,,,ebBold
               Text 8,96,72,8,"Owner",.Text42,,,ebBold
               Text 88,96,160,8,"an owner of target view class",.Text43
               Text 88,104,160,8,"copy owner from domain class list",.Text44
       End Dialog

       ' create dialog variables
          Dim MyDialog As ViewWizardDialog
       Dim MyAboutDialog As AboutDialog

       Dialog MyDialog
       Dialog MyAboutDialog

End Sub

'------------------------------------------------------------------

 3)

 The only fix that is available is to reorganize the above script.
 To work around the stack limitation, you need to place the dialog
 declarations into subroutines. Modified the above script to
 demonstrate:

'------------------------------------------------------------------

Sub Dialog1()
       Dim theCategories () As String
       Dim anyList () As String
       Begin Dialog ViewWizardDialog ,,292,225,"View Wizard"
               GroupBox 4,4,284,52,"Domain",.GroupBox1
               Text 8,16,32,8,"Package:",.ClassPackage
               DropListBox 8,24,136,80,theCategories$,.ClassPackageListBox
               Text 148,16,32,8,"Class:",.Text1
               DropListBox 148,24,136,80,anyList$,.ClassListBox
               Text 120,44,24,8,"Owner:",.Text7
               TextBox 148,40,124,12,.OwnerName
               PushButton 272,40,12,12,"<-",.CopyOwnerButton
               CheckBox 56,60,60,8,"Show inherited",.InheritedCeckBox
               Text 8,60,32,8,"Attributes:",.Text2
               ListBox 8,72,108,64,anyList$,.AttributeList
               PushButton 124,72,12,12,">>",.AllRightButton
               PushButton 124,88,12,12,">",.OneRightButton
               PushButton 124,104,12,12,"X",.OneDeleteButton
               PushButton 124,120,12,12,"XX",.AllDeleteButton
               Text 144,60,36,8,"Inclusions:",.Text3
               ListBox 144,72,108,64,anyList$,.InclusionList
               PushButton 260,72,24,14,"Up",.UpButton
               PushButton 260,88,24,14,"Down",.DownButton
               PushButton 260,104,24,14,"Edit",.EditButton
               PushButton 260,120,24,14,"New",.NewButton
               Text 8,136,20,8,"Path:",.Text8
               TextBox 28,136,224,12,.Path
               GroupBox 4,152,284,52,"View",.GroupBox2
               Text 8,164,32,8,"Package:",.Text4
               DropListBox 8,172,136,84,theCategories$,.ViewPackageListBox
               Text 148,164,32,8,"Diagram:",.Text6
               DropListBox 148,172,136,80,anyList$,.ViewDiagramListBox
               Text 8,192,24,8,"Name:",.Text5
               TextBox 32,188,112,12,.ViewName
               CheckBox 196,192,47,8,"Top view",.TopCheckBox
               OKButton 4,208,48,14,.CreateButton
               PushButton 124,208,48,14,"About",.AboutButton
               CancelButton 240,208,48,14,.CancelButton
       End Dialog
       Dim MyDialog As ViewWizardDialog
       Dialog MyDialog
End Sub

Sub Dialog2()
       Begin Dialog AboutDialog ,,255,264,"About View Wizard"
                CancelButton 112,248,40,14
               Text 92,4,80,16,"View Wizard",.Text1,,14,ebBold
               Text 84,20,104,8,"Rado1 Cervenka, Aitecons.r.o.",.Text2
               Text 108,28,52,8,"[EMAIL PROTECTED]",.Text3
               Text 16,40,228,24,"The View Wizard dialog is aimed to help with
automatic creation of View Classes from the Domain Classes And placing them
into model diagrams. For more detailed description see the HML language
specification.",.Text4
               Text 8,80,72,8,"Domain / Package",.Text5,,,ebBold
               Text 8,88,72,8,"Domain / Class",.Text6,,,ebBold
               Text 8,184,72,8,"View / Package",.Text7,,,ebBold
               Text 8,192,72,8,"View / Diagram",.Text8,,,ebBold
               Text 8,200,72,8,"View / Name",.Text9,,,ebBold
               GroupBox 4,68,248,176,"Dialog Item Descriptions",.GroupBox1
               Text 8,112,72,8,"Attributes",.Text10,,,ebBold
               Text 8,144,72,8,"Inclusions",.Text11,,,ebBold
               Text 88,80,160,8,"a package containing the source domain
class",.Text12
               Text 88,88,160,8,"the source domain class",.Text13
               Text 88,112,160,8,"attributes of the source domain
class",.Text14
               Text 88,144,160,8,"inclusions being created in the target view
class",.Text15
               Text 88,184,160,8,"a package which will contain the target view
class",.Text16
               Text 88,192,160,8,"a diagram which will display the target view
class",.Text17
               Text 88,200,160,8,"a name of the target view class being
created",.Text18
               Text 8,128,72,8,">   >>",.Text19,,,ebBold
               Text 88,128,160,8,"move item(s) from attribute to inclusion
list",.Text20
               Text 8,152,72,8,"Up, Down",.Text21,,,ebBold
               Text 8,216,72,8,"OK",.Text22,,,ebBold
               Text 8,232,72,8,"Cancel",.Text24,,,ebBold
               Text 8,224,72,8,"About",.Text25,,,ebBold
               Text 88,152,160,8,"change an order of inclusions",.Text26
               Text 88,216,160,8,"create the new target view class",.Text27
               Text 88,232,160,8,"cancel the View Wizard (all actions remains
valid)",.Text29
               Text 88,224,160,8,"this window",.Text30
               Text 8,136,72,8,"X   XX",.Text31,,,ebBold
               Text 88,136,160,8,"delete inclusion(s)",.Text32
               Text 8,208,72,8,"View / Top view",.Text33,,,ebBold
               Text 88,208,160,8,"top view indicator",.Text34
               Text 8,120,72,8,"Show inherited",.Text23,,,ebBold
               Text 88,120,160,8,"dispaly also inherited attributes",.Text28
               Text 8,160,72,8,"Edit",.Text35,,,ebBold
               Text 8,168,72,8,"New",.Text36,,,ebBold
               Text 8,176,72,8,"Path",.Text37,,,ebBold
               Text 88,160,160,8,"edit an existing inclusion",.Text38
               Text 88,168,160,8,"add new inclusion",.Text39
               Text 88,176,160,8,"navig. path of  inclusions created from
attributes",.Text40
               Text 8,104,72,8,"<-",.Text41,,,ebBold
               Text 8,96,72,8,"Owner",.Text42,,,ebBold
               Text 88,96,160,8,"an owner of target view class",.Text43
               Text 88,104,160,8,"copy owner from domain class list",.Text44
       End Dialog
       Dim MyAboutDialog As AboutDialog
   Dialog MyAboutDialog
End Sub

Sub Main
       Dialog1
       Dialog2
End Sub

'------------------------------------------------------------------

Patrick Kennedy
 Rational Support

On Jul 3, 16:08, Andr� VEGA wrote:
> Subject: (ROSE) Rational Rose:Out of stack space
>
> Hi,
> I'm using recursive function within a script,
> and while runnig the compiled version of my script,
> I run into following error: #28: Out of stack space
>
> I need to increase my stack space for running my script properly.
> Does anyone got some idea or workaround?
>
> I've read the following note 11092 in release notes:
> "BEGIN OF RELEASE NOTES***
> Despite BasicScript's efforts to use memory efficiently, memory may
> still fill up. In this case, the user receives the trappable error "Out
> of string space," or the fatal error Out of memory.
>  The ebInit function creates the string space memory area with a maximum
> size of  4K. This maximum can be increased by calling the
> ebInstance_SetPublicSpace function. The following code sets the maximum
> to 1 MB: ebInstance_SetPublicSpace(hInst,0x100000L);
> ***END OF RELEASE NOTES"
>
> Does anyone knows more about that magic ebInstance_SetPublicSpace,
> and where to call it from a rose script, and where to find it (dll or
> lib)?
>
> Thanks, Andre.
> --
> ------------------------------------------------
> Andr� VEGA
> [EMAIL PROTECTED]
> 01.46.08.63.27
> ------------------------------------------------
>
>
> ************************************************************************
> * Rose Forum is a public venue for ideas and discussions.
> * For technical support, visit http://www.rational.com/support
> *
> * Admin.Subscription Requests: [EMAIL PROTECTED]
> * Archive of messages:
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
> * Other Requests: [EMAIL PROTECTED]
> *
> * To unsubscribe from the list, please send email
> *
> * To: [EMAIL PROTECTED]
> * Subject:<BLANK>
> * Body: unsubscribe rose_forum
> *
> *************************************************************************
>-- End of excerpt from Andr� VEGA


************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages: 
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*
* To: [EMAIL PROTECTED]
* Subject:<BLANK>
* Body: unsubscribe rose_forum
*
*************************************************************************

Reply via email to