increase in process memory....

increase in process memory....

Anonymous
Not applicable
441 Views
6 Replies
Message 1 of 7

increase in process memory....

Anonymous
Not applicable
hi..
i created a sub routine to increase a part's length repetitively.. but when i update it.. my process memory is increasing around 0.2Mb to 0.3 Mb for each repetition..

how to overcome this trouble.. coz i have to run this routine for more than 3000 times.. and is eating my RAM memory

i am pasting some part of the code here
--------------------------------------------------------------
Dim j As Double
Dim hoist As ComponentOccurrence
For Each hoist In hookocc.SubOccurrences
If hoist.Name = "hoist:1" Then
Dim hoistdef As PartComponentDefinition
Set hoistdef = hoist.Definition
Dim hoistlength As Parameter
Set hoistlength = hoistdef.Parameters.Item("hoistlen")
j = hoistlength.Value / 100 'm
hoistlength.Value = (j + 0.5) * 100 'm
Exit For
End If
Next
asmdoc.Update
--------------------------------------------------------------
0 Likes
442 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
From your script I am quessing the following:

1. You have referenced a sub assembly in your main assembly.

2. You then loop through each part within the sub assy until you find the required part.

3. Once the requred part is found, you change the Length parameter.

If the above is correct, I cant see why your RAM is been eaten away. I have similar routines that update 1000's of parameters in around 10 secs.

Try using the Expression type rather than value:-

hoistlength.Expression = (j + 0.5) * 100 'm
0 Likes
Message 3 of 7

Anonymous
Not applicable
You placed two DIM commands inside FOR..NEXT loop.
Each time DIM command allocates (eats) some memory for your objects.
It is good idea to remove DIM instructions from FOR…NEXT loop.
Place them all together before the loop.

Hope this will help.

ALink
0 Likes
Message 4 of 7

Anonymous
Not applicable
i tried using the expression also...
not much change in memory leek...

i registered a request in Developer Network, they told they don't have a solution for this problem right now...
0 Likes
Message 5 of 7

Anonymous
Not applicable
The dim statements are evaluated only once because there is a 'if' clause in between the for loop..
and there is only one occurrence with that name and the dim statements are evaluated only when the occurrence is detected and after that the loop will be broken by the 'exit for' statement
0 Likes
Message 6 of 7

Anonymous
Not applicable
I dont know why you are having this problem. Attached is the script I use with no problems. Its .Net 2005 so you may have to edit for VBA.

My values come from a datatable, and the sub edits Part parameters in the main assembly and part parameters in a sub assembly.
0 Likes
Message 7 of 7

Anonymous
Not applicable
Problem is with "asmbdoc.update" method only...
there is increase in memory whenever this 'update' command is used..

i think u did not used update command.. thats why u r not finding the memory increase... i tried using VBA and also addin created in VB2005, the same problem exits..
the parameter i am changing is in a sketch. and some feature dimensions are referenced to it.. is there any problem with that..?
0 Likes