Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Skip list of buffers
Topic Summary:
Created On: 6-Aug-2007 13:26
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 6-Aug-2007 13:26
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

Hi all,

is it possible to create a skip list with keys being integers and values being buffers? I tried the attached code snippet, but as a result only got "worlworld", i.e. the last buffer put into the skip list.
I guess it has to do with how buffers are stored in memory, but any clarification would be appreciated.

Regards,

Peter
Report this to a Moderator Report this to a Moderator
 6-Aug-2007 13:49
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Peter,

Buffers are handled like pointers, so you need to create separately each Buffer you want to place in a Skip list.
In your example you stored two times the same Buffer in the Skip, so it will show the same value, if you modify one of them

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 6-Aug-2007 16:02
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

Hi Reik,

all right, thanks for the explanation. The dummy examples works properly when modified as you suggested.

Just a side note in case someone else is going this way: You should not delete the Buffers after putting them into the Skip lists! If so, the loop creates just garbage result.

Cheers,

Peter
Report this to a Moderator Report this to a Moderator
 6-Aug-2007 18:12
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Well at the end of your program, I'd delete them. You could still get a handle to them one at a time through their keys and delete them that way. Then delete the Skip List itself. Just have a variable keep track of how many buffers are in the skip list.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Edited: 6-Aug-2007 at 18:14 by David Pechacek
Report this to a Moderator Report this to a Moderator
 8-Aug-2007 00:16
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

You cannot just delete them straight forwardly?:
for buf in skp do {delete(buf)}
delete skp
Report this to a Moderator Report this to a Moderator
 8-Aug-2007 10:36
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

I experimented a bit and found the following strange behaviour:

a) yes, you can delete the Buffer values straightforward, as Louie suggests, but it has
b) (sometimes) no impact on the memory consumption. However
c) failing to delete the Buffer elements drastically increases the time required to delete the Skip list itself!

The attached script repeatedly creates a skip list, fills it with Buffer values and deletes the skip list. The latter action is once done with deleting the individual buffer values, and once not.

When I start a fresh DOORS session while constantly observing the Windows Task Manager, DOORS starts off with ~ 43K. Running the script in the DXL window produces the following output:

200 loops, 100 elements:
With deletions of Buffers: 0 seconds
Without deletions of Buffers: 21 seconds

While the memory consumption in the Task Manager did not change. Thus, no leak, whether with or without deleting the Buffers. But without deleting the individual Buffers, the script runs orders of magnitude slower!

No the weird thing: While I was testing this, now and then the DOORS memory consumption in the Task Manager dropped down to around 2K, and after that, not deleting the individual Buffers did actually increase memory consumption, thus a memory leak occured.

It happened several times, but I was not yet able to reproduce this behaviour. And I have no idea whatsoever what might cause this.

Ergo, I would strongly recommend to delete the Buffers before deleting the Skip list, as it anyway reduces program running time and might prevent memory leaks.

Cheers,

Peter
Report this to a Moderator Report this to a Moderator
 8-Aug-2007 15:49
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I've seen [c] before. Very important that we know it. Makes me wonder what happens when the Skip you delete contains non-buffer things, like strings...

I've also seen the inexplicable drop in memory useage by DOORS a few years ago. IIRC I was demonstrating memory loss in some buffer command. I demonstrated that it occurs fairly randomly and not as a direct consequence of a sequence of DXL calls. IIRC, it occurs ONCE per script. Back then I contacted support under the impression there existed some sort of 'clean up leaked memory' function and hoping to get it, the response I got was that the developers were stumped at that behavior. Sure looks like there is some sort of memory reclamation, perhaps we should ask them again about it.

- Louie
Report this to a Moderator Report this to a Moderator
 8-Aug-2007 16:30
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

As for [c] above: When experimenting on this, I did not see anything like that when the Skip contained strings. I did not bother deleting the elements one by one, as the deletion of the Skip list always happened instantly, regardless of the number of elements.

However, the situation is again different for the more obscure things like DxlObjects: Here, not deleting the elements has no impact on the time required for the deletion of the Skip list; however, it _does_ create a huge memory leakage. Therefore here, for different reasons, one should also delete the elements prior to the Skip list.

As for the memory usage, what strikes me is that the drop is that deep. Fresh from the start, with no DXL run so far, no Module opened, DOORS is at > 40K. Just the main explorer window. Then, after the drop, it is around 2K, and I wonder what is possibly missing now. Or, if it is really leaked memory, it must be in the explorer window code itself (which is written in DXL, is it not?).

And, also strange, after the drop the Buffer skip elements leaked memory, while before they didn't. So something quite general changed in the way the DXL code is interpreted.

Unfortunately I am still on DOORS v7.0, so there is no point in asking Telelogic, but once we upgraded to a more decent version, I'll wait and see if I still see the memory drop.

Peter
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 2 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.