We've been testing our DOORS 8.3 scripts in DOORS 9.3 and discovered that some of our scripts that run successfully in DOORS 8.3 run out of memory in DOORS 9.3. In one case the script processed 28 modules in DOORS 8.3 but could not complete a single module in DOORS 9.3 without running out of memory.
These scripts follow a lot of links and open up a lot of modules to gather data. In the end I would estimate that up to 70 modules are opened up.
I was not the author of these scripts, and when I checked them out I discovered that they did a poor job of memory management. After I made significant changes to improve the memory management, including closing modules when they were no longer being used. I was able to get one of the scripts to process 1 or 2 modules before running out of memory. In DOORS 8.3 the same script, before the improvements were made with memory management, was able to process all 28 primary modules, opening up about 70 modules at the same time.
Has anyone else noticed issues with DOORS 9.x running out of memory more frequently than with DOORS 8.x? I am guessing that when DOORS 9.x opens a module it uses more memory than when DOORS 8.x opens a module. Can anyone verify this?
David_G_Bond - Mon May 23 10:30:27 EDT 2011 |
|
Re: Memory Issues in DOORS 9.x? pete.kowalski - Mon May 23 13:01:07 EDT 2011
Are you using regxp?
|
|
Re: Memory Issues in DOORS 9.x? David_G_Bond - Mon May 23 13:09:49 EDT 2011 pete.kowalski - Mon May 23 13:01:07 EDT 2011
Are you using regxp?
There are half a dozen global Regexp definitions.
|
|
Re: Memory Issues in DOORS 9.x? pete.kowalski - Mon May 23 13:34:37 EDT 2011 David_G_Bond - Mon May 23 13:09:49 EDT 2011
There are half a dozen global Regexp definitions.
The regexp is your problem then probably.
The regular expression engine was rewritten somewhat in DOORS 9.X and now it consumes more memory compared to previous DOORS versions.
I believe the "delete" function was overloaded to now support regexp in DOORS 9.X so if you are not deleting your regular expressions try that.
|
|
Re: Memory Issues in DOORS 9.x? David_G_Bond - Mon May 23 15:18:07 EDT 2011 pete.kowalski - Mon May 23 13:34:37 EDT 2011
The regexp is your problem then probably.
The regular expression engine was rewritten somewhat in DOORS 9.X and now it consumes more memory compared to previous DOORS versions.
I believe the "delete" function was overloaded to now support regexp in DOORS 9.X so if you are not deleting your regular expressions try that.
OK, so I moved the global Regexp definitions into the subroutines that use them and delete them at the end of the subroutine. I'll let you know how that works when they are defined locally and then deleted.
We've always made Regexp's global to minimize memory leaks, but we'll try it this way. It's a bit of a shame, though, because now we will have the same definition in multiple places.
|
|
Re: Memory Issues in DOORS 9.x? David_G_Bond - Mon May 23 16:29:10 EDT 2011 David_G_Bond - Mon May 23 15:18:07 EDT 2011
OK, so I moved the global Regexp definitions into the subroutines that use them and delete them at the end of the subroutine. I'll let you know how that works when they are defined locally and then deleted.
We've always made Regexp's global to minimize memory leaks, but we'll try it this way. It's a bit of a shame, though, because now we will have the same definition in multiple places.
The changes to the Regular Expression handling made no difference. The script failed in exactly the same place.
|
|
Re: Memory Issues in DOORS 9.x? Mathias Mamsch - Tue May 24 07:50:30 EDT 2011 David_G_Bond - Mon May 23 16:29:10 EDT 2011
The changes to the Regular Expression handling made no difference. The script failed in exactly the same place.
I did some work on DOORS memory managament in DOORS 8.2 recently - I hooked into the memory management to find out exactly where in the code the memory leaks are happening. I would like to test that with your scripts on DOORS 9. If you want, we can get in touch and see if the tools will be able to determine the cause of the memory leak, so we can file a bug report or correct a possible bug in the scripts. Mail me if you are interested m_m_amsch@googlemail.com (remove underscores).
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Memory Issues in DOORS 9.x? jdoucement - Thu May 26 10:30:44 EDT 2011 Mathias Mamsch - Tue May 24 07:50:30 EDT 2011
I did some work on DOORS memory managament in DOORS 8.2 recently - I hooked into the memory management to find out exactly where in the code the memory leaks are happening. I would like to test that with your scripts on DOORS 9. If you want, we can get in touch and see if the tools will be able to determine the cause of the memory leak, so we can file a bug report or correct a possible bug in the scripts. Mail me if you are interested m_m_amsch@googlemail.com (remove underscores).
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Hi everyone,
Just like Mathias I experienced memory management troubles those days with DOORS 8.3. I didn't use any regexp, I'm just using DXL attributes with objects having up to 2000 incoming links. Anyway, I think the way I got out of this issue could help you.
Give a try to pragmas.
Like:
pragma runLimit, 0 // actually no limit
pragma stack, 10000000 // it looks huge, doesn't it? In fact, not so huge if you consider all the recursive loops that might be caused by regexps.
Let us know!
Cheers,
Jean
|
|
Re: Memory Issues in DOORS 9.x? David_G_Bond - Thu May 26 12:54:56 EDT 2011 jdoucement - Thu May 26 10:30:44 EDT 2011
Hi everyone,
Just like Mathias I experienced memory management troubles those days with DOORS 8.3. I didn't use any regexp, I'm just using DXL attributes with objects having up to 2000 incoming links. Anyway, I think the way I got out of this issue could help you.
Give a try to pragmas.
Like:
pragma runLimit, 0 // actually no limit
pragma stack, 10000000 // it looks huge, doesn't it? In fact, not so huge if you consider all the recursive loops that might be caused by regexps.
Let us know!
Cheers,
Jean
I tried setting the stack as you recommended. This caused the script to fail even sooner. I am trying to determine where the problem is occurring. If I can figure that out, maybe it will lead to a solution.
|
|
Re: Memory Issues in DOORS 9.x? Mathias Mamsch - Thu May 26 14:26:43 EDT 2011 jdoucement - Thu May 26 10:30:44 EDT 2011
Hi everyone,
Just like Mathias I experienced memory management troubles those days with DOORS 8.3. I didn't use any regexp, I'm just using DXL attributes with objects having up to 2000 incoming links. Anyway, I think the way I got out of this issue could help you.
Give a try to pragmas.
Like:
pragma runLimit, 0 // actually no limit
pragma stack, 10000000 // it looks huge, doesn't it? In fact, not so huge if you consider all the recursive loops that might be caused by regexps.
Let us know!
Cheers,
Jean
The pragma stack will only set the DXL stack for the current DXL context, not the internal stack of the DOORS client. Therefore all builtin perms like regexp are not influenced at all by this pragma.
Putting "pragma stack, 10000000" in front of your program will only increase the memory size of your program to 8 MB before it starts up. This way you can now create one dimensional arrays with a big size, and you need to do this whenever you store stuff like all objects of a module in a one dimensional array (which goes on the stack!). All other data types like Array, Buffer, etc. go on the heap. For those you do not need to set the stack size.
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Memory Issues in DOORS 9.x? SystemAdmin - Thu May 26 21:10:11 EDT 2011 David_G_Bond - Mon May 23 16:29:10 EDT 2011
The changes to the Regular Expression handling made no difference. The script failed in exactly the same place.
Without seeing the code we're starting to clutch at straws and guess as to which library functions IBM may have modified in 9.3 that have become memory hungry.
An outside chance - one potential source of memory hogging is when opening a module - is the script opening modules invisible or visible (invisible uses less memory)?
W.r.t. the two modules that you mentioned had managed to open before failure set in - do either of these modules have triggers running DXL code that maybe using Regexp, or maybe a default view with DXL layout or DXL attributes that maybe the source of memory hogging? A possible knock on effect is that if there are any DXL layout's in the default view that trace to incoming\outgoing links, then the modules at the other end of these links will be opened invisible as well and will consume memory.
To help exclude the modules from being a part of the problem - keep a watch on memory usage in the Windows Performance Monitor as you open and close the modules manually, if any large memory blips appear and don't disappear after closing then maybe this is where to concentrate further.
Paul Miller
Melbourne, Australia
|
|
Re: Memory Issues in DOORS 9.x? David_G_Bond - Fri May 27 16:16:07 EDT 2011 SystemAdmin - Thu May 26 21:10:11 EDT 2011
Without seeing the code we're starting to clutch at straws and guess as to which library functions IBM may have modified in 9.3 that have become memory hungry.
An outside chance - one potential source of memory hogging is when opening a module - is the script opening modules invisible or visible (invisible uses less memory)?
W.r.t. the two modules that you mentioned had managed to open before failure set in - do either of these modules have triggers running DXL code that maybe using Regexp, or maybe a default view with DXL layout or DXL attributes that maybe the source of memory hogging? A possible knock on effect is that if there are any DXL layout's in the default view that trace to incoming\outgoing links, then the modules at the other end of these links will be opened invisible as well and will consume memory.
To help exclude the modules from being a part of the problem - keep a watch on memory usage in the Windows Performance Monitor as you open and close the modules manually, if any large memory blips appear and don't disappear after closing then maybe this is where to concentrate further.
Paul Miller
Melbourne, Australia
Paul,
Thanks for your thoughts. I can't provide the script because it is both very big and filled with proprietary information.
We open the modules invisible and in standard view. There are triggers on some of the modules, but they are only activated if the modules are open in edit mode. We open the modules in read mode since data is gathered for a report and no changes to any modules are made. Standard view ensures that there are no layout dxls.
I use the Windows task manager and I see the memory use go up as modules are opened and then go down as they are closed. Whey the memory use goes down, it never goes to the same level as before the modules are processed. I know there are memory leaks - I just don't know where they might be or why they should be more severe than with DOORS 8.3.
|
|
Re: Memory Issues in DOORS 9.x? SamLund - Mon May 30 10:53:00 EDT 2011 David_G_Bond - Fri May 27 16:16:07 EDT 2011
Paul,
Thanks for your thoughts. I can't provide the script because it is both very big and filled with proprietary information.
We open the modules invisible and in standard view. There are triggers on some of the modules, but they are only activated if the modules are open in edit mode. We open the modules in read mode since data is gathered for a report and no changes to any modules are made. Standard view ensures that there are no layout dxls.
I use the Windows task manager and I see the memory use go up as modules are opened and then go down as they are closed. Whey the memory use goes down, it never goes to the same level as before the modules are processed. I know there are memory leaks - I just don't know where they might be or why they should be more severe than with DOORS 8.3.
Quite recently, we had similar experiences, including significant "residual" reservation for memory.
Situation got a bit improved with strict adherence to following:
-
delete any skip lists after the operation
-
use preferably integer indexed skip lists
-
setempty and delete any buffers after the operation
-
set any string variables to null after the operation
-
not a single variable what so ever to be declared inside any sort of loop.
-
global string variables (only, or mainly). Minimize number of string variables declared.
-
AND check attribute DXL for the same! Module misbehavior counts!
These measures helped us to get it through.
Old scripts, in particular if one has "inherited" these from somewhere, tend to fail in several of those points. And agreeing with you, 9.x is happy to levy a heavy fine.
|
|
Re: Memory Issues in DOORS 9.x? David_G_Bond - Tue May 31 15:15:03 EDT 2011 SamLund - Mon May 30 10:53:00 EDT 2011
Quite recently, we had similar experiences, including significant "residual" reservation for memory.
Situation got a bit improved with strict adherence to following:
-
delete any skip lists after the operation
-
use preferably integer indexed skip lists
-
setempty and delete any buffers after the operation
-
set any string variables to null after the operation
-
not a single variable what so ever to be declared inside any sort of loop.
-
global string variables (only, or mainly). Minimize number of string variables declared.
-
AND check attribute DXL for the same! Module misbehavior counts!
These measures helped us to get it through.
Old scripts, in particular if one has "inherited" these from somewhere, tend to fail in several of those points. And agreeing with you, 9.x is happy to levy a heavy fine.
Sam,
Thanks for your suggestions. The script incorporates all of your suggestions. We never declare any variables inside of loops. We properly restore dynamic memory involving skip lists, buffers, and regular expressions. String variables are handled with great care.
To ensure that layout dxls are not an issue, all modules are opened (read-only, invisible) in standard view. Very few of our attributes are dxl attributes and none of those are involved in the script. If and when I discover the causes I will be sure to share that information here.
Thanks,
|
|
Re: Memory Issues in DOORS 9.x? SystemAdmin - Tue May 31 19:49:18 EDT 2011 David_G_Bond - Tue May 31 15:15:03 EDT 2011
Sam,
Thanks for your suggestions. The script incorporates all of your suggestions. We never declare any variables inside of loops. We properly restore dynamic memory involving skip lists, buffers, and regular expressions. String variables are handled with great care.
To ensure that layout dxls are not an issue, all modules are opened (read-only, invisible) in standard view. Very few of our attributes are dxl attributes and none of those are involved in the script. If and when I discover the causes I will be sure to share that information here.
Thanks,
This where an IDE for DXL would be real handy - then you could step through each line of code and monitor memory usage to try and isolate where the memory is being hogged.
This might sound drastic - but perhaps consider creating a simple debug function that halts execution until you press return to continue (e.g. use the ack() message box function). Something that simulates the step function of an IDE. Insert the function call in various parts of the code and monitor memory usage on Task Manager each time the code is halted and hopefully start to zero in on the DXL code that is the cause of this problem.
Paul Miller
Melbourne, Australia
|
|