Memory management in Rational DOORS

Monitor and control memory use with API's

This article shows how to use DXL APIs to effectively manage memory when you use DXL scripts in DOORS. With these APIs, you can monitor the memory used by DOORS. You can take action when the memory used by DOORS reaches the maximum threshold level. The APIs help to avoid loss of data due to an abrupt stop of the application.

Share:

Vinay Nanjundappa (vinay.nanjundappa@in.ibm.com), Senior Application Developer, IBM

Author1 photoVinay Nanjundappa has worked on the development team for IBM Rational DOORS for more than 7 years. He works with DOORS RFEs, consults with other teams on customer queries, and provides technical guidance about various modules (such as IBM Rational Directory Server and reporting.) He has developed extraction, transformation, and loading (ETL) for DOORS reporting using IBM Rational Insight and the IBM Cognos Data Manager tool. His specialty is DOORS to Rational Directory Server integration and DOORS to IBM Rational Reporting for Document Generation. In addition, he solves critical customer issues.



11 March 2014

Introduction

IBM® Rational® DOORS® does not track modules that are opened in the background by Rational DOORS extension language (DXL) programs. For example, if a DXL program opens other modules in the background and does not close them, memory use continues to increase. The DOORS client cannot close the modules, even if it has run out of memory. Eventually, the DOORS client terminates. To avoid this problem, you can use three perms, which are DOORS DXL APIs. These perms perform the following actions:

  • Track and close modules
  • Monitor the memory use by the DOORS application
  • Display appropriate warnings

How to use memory management perms

Use the following perms to manage memory in Rational DOORS:

  • initNotDisplayedOpenModules(): This perm records the modules that are already prior to any operation. Call this perm at the beginning of any looping operation.
  • DisplayMemoryWarning(): This perm checks the memory usage of the application and closes modules opened in the back end, when the application uses more memory than the prescribed warning level. Place this perm inside a for or while loop so that the memory is monitored in each iteration, at regular intervals.
  • closeNotDisplayedOpenedModules(): This perm does all of the cleanup operations at the end and closes all modules opened in the back end, at the end of any operation.

Use the three perms shown in Listing 1. You can use the perms in combination. You can also use them when you iterate through all the objects in a module that has large amount of data. Another instance when you can use the perms is when there are more number of objects in a module.

Listing 1. Example of how to use memory management perms

Click to see code listing

Listing 1. Example of how to use memory management perms

    Module m = current
 Object o = first m
 initNotDisplayedOpenModules()// First perm is placed at the beginning of operation before looping of Objects.
 int i = 0
 for o in m do
  {
         if (DisplayMemoryWarning())  //Second perm which tracks memory usage and warns user.               
        {
              break // stop if user selects to abort the operation, when warning is displayed
         }
         i = o."Absolute Number"
         gotoObject(i, m)
         o = next o
  }   
  closeNotDisplayedOpenedModules() // Third perm which does clean up operation at end and closes all modules opened in backend.

Notes:

  • initNotDisplayedOpenModules() is used before the start of the operation.
  • DisplayMemoryWarning() is used during actual operation, within a for or while loop, which monitors the memory used by the application and does the clean up job when memory reaches the prescribed limit.
  • closeNotDisplayedOpenedModules() is used at the end of the operation.

Use these perms in any custom DXL code that includes looping of all objects in a big module with a large amount of data and with links to other modules. To use these perms effectively, place them inside a loop that loops through all the objects or columns in the DOORS module to collect data.

Customize the memory management perms

Memory usage varies from system to system.DOORS can use more memory for its operations on systems with adequate memory. It is impossible to make a general rule about the maximum memory that can be used by DOORS. However, you can use registry values to customize memory management and to set the system memory that DOORS can use.

Set default values in Rational DOORS

By default certain parameters are set. You can override these values with registry entries set under the DOORS client registry, under the config key. Use the following registry string keys:

  • MEM_LEVEL_CLOSE: The default value is 1000MB. When this value is reached, the memory management perm starts closing the opened modules that it keeps track of. To override this maximum value, use the string registry key entry MEM_LEVEL_CLOSE under DOORS Client > Config and specify the suitable value. Specify the maximum memory (in MBs) that your system can allocate to DOORS as the value under this registry key. For example if a machine can allocate 2GB of memory to doors.exe without crashing, the value for this registry key needs to be 1800 or 2000. You need to experiment with values until you find the correct setting. The higher the value, the better the performance, but the machine needs to be able to support a high value.
  • MEM_LEVEL_WARN: The default value is 800MB. On reaching this level, the memory management perm warns the user to either continue or to end the operation to avoid a crash. To override this value, use the registry key entry MEM_LEVEL_WARN under DOORS Client > Config and specify a suitable value. Based on this value, Rational DOORS starts closing all back end, open modules when the application reaches the value set in MEM_LEVEL_CLOSE. Even after closing all background modules, if the memory used by Rational DOORS is more than the value specified for the MEM_LEVEL_WARN registry entry, Rational DOORS shows a warning message. This warning indicates that Rational DOORS is using more memory than the value set as the warning level. An ideal value is 800 to 1600 for a 2GB RAM machine.
  • MEM_LEVEL_STEP: The default value is 200MB. This value is used to step up the MEM_LEVEL_WARN level at run time. A warning is displayed at run time and at that time you can increase the MEM_LEVEL_WARN level. To override this value, specify a suitable value on the registry entry MEM_LEVEL_STEP under DOORS Client > Config.

Note: Consider including instructions for how to respond to these perms. In some cases, a warning is displayed when DOORS reaches the value specified as the MEM_LEVEL_WARN level. At that point, you have to choose whether to continue or stop the application. These perms can also slightly affect performance because the memory is checked and modules are closed at regular intervals. Adjust the settings by using registry entries so that performance is not affected and your system does not crash.


Summary

This article showed how to use DXL APIs to effectively manage memory when you use DXL scripts in DOORS. Now that you have the APIs, you can monitor the memory used by DOORS. You can take action when the memory used by DOORS reaches the maximum threshold level and thus avoid loss of data due to an abrupt stop of the application.

Resources

Learn

Get products and technologies

Discuss

  • Join the Rational DOORS forum to ask questions and participate in discussions.
  • Get connected with your peers and keep up on the latest information in the Rational community.
  • Follow Rational software on Facebook, Twitter (@ibmrational), and YouTube, and add your comments and requests.
  • Ask and answer questions and increase your expertise when you get involved in the Rational forums, cafés, and wikis.

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=965034
ArticleTitle=Memory management in Rational DOORS
publish-date=03112014