![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: regexp memory leak Topic Summary: avoid excess regexp calls in your dxl Created On: 6-Oct-2006 18:34 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I have found that if you call regexp within a function (Doors 8.1.0.1), memory gets consumed, but does not get released until the dxl has ended (rather than the function). Try running this script, I notice a 8 MB change after running the regexp command 1000 times (no change at all when running the dummy version without the regexp). Once the script exits, all memory seems to be reclaimed.
P.S. I did post this previously as a response to a different topic, but I felt that it should probably get its own thread so that people could post work-arounds or any insight they might have into this issue.
Edited: 6-Oct-2006 at 18:36 by Andrew Wallen |
|
![]() |
|
![]() |
|
Good afternoon, sir! |
|
![]() |
|
![]() |
|
For simple cases, like the simple program I posted above, refactoring is certainly the easiest way.
My main reason for posting was to raise awareness of this issue. It took me a couple hours wading through a rather complex dxl to track down the source of the memory leak and I was hoping to save others some of that aggrevation.
BTW, in my case, the regexp calls couldn't be easily refactored out of the function where they were because other dxls were relying on being able to pass a string representation of a regexp to the function. In my case, I chose to implement a small cache to store regexps.
I also did some experimenting and confirmed that executing within an eval_() also worked without any sort of memory leak. Both systems have merit: the cache is simpler to insert into existing programs, while the eval_ solution works without any memory leaking away.
I'll post code examples when I get a chance.
|
|
![]() |
|
![]() |
|
Good news the space gets freed up after the script ends. Some kinds of leaks only get freed up after DOORS itself exists.
My testing also showed a rather big performance degredation, suggesting that calculating a regexp takes a lot of space and a lot of time. That effort was triggered during testing of one of my most basic functions (fGetOffset), which it turns out gets called 100s of 1000s times in the big DXL scripts. Yes, when the RegExp is a constant (like leading spaces) declare it in a 'global' outside the function. I guess I should do some testing vis-a-vis all this: [1a] time and [1b] space degradation for the [2a] declaration and [2b] use of Regular expressions. - Louie |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
regexp memory leak
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.