I'm adding a bunch of calculated members to a cube using DSO in Visual Basic. It has a very seriuos memory leak, and I couldn't figure out, why. The memory leak affects the real memory usage as well, but the more serious problem is that it eats very much virtual memory, so much that the paging file grows to the size of the available maximum, and the system is slowed down, and the program fails.
the routine is something like this:
Do Until Recs.EOF
MeasureName = Recs.Fields(0).Value
MDXStatement = Recs.Fields(1).Value
SolveOrder = Recs.Fields(4).Value
FormatStr = Recs.Fields(2).Value
Parent = Recs.Fields(3).Value
VisibleFlag = Recs.Fields(5).Value
Set Command = Cube.Commands.AddNew(MeasureName)
Command.CommandType = cmdCreateMember
Command.Name = MeasureName
Command.Statement = _
"CREATE MEMBER CURRENTCUBE." + Parent + ".[" + MeasureName + "] AS '" + _
MDXStatement + "', SOLVE_ORDER=" + Str(SolveOrder) + ", FORMAT_STRING='" + _
FormatStr + "', VISIBLE=" + VisibleFlag
Set Command = Nothing // test
Recs.MoveNext
Loop
Recs.Close
Set Recs = Nothing // test
Cube.Update
Set Cube = Nothing // test
the lines marked with "//test" are inserted later to try if they help, but they doesn't.
what can be the reason of this memory leak? how to work around it?
many thanks in advance
Krisztian Pinter
the routine is something like this:
Do Until Recs.EOF
MeasureName = Recs.Fields(0).Value
MDXStatement = Recs.Fields(1).Value
SolveOrder = Recs.Fields(4).Value
FormatStr = Recs.Fields(2).Value
Parent = Recs.Fields(3).Value
VisibleFlag = Recs.Fields(5).Value
Set Command = Cube.Commands.AddNew(MeasureName)
Command.CommandType = cmdCreateMember
Command.Name = MeasureName
Command.Statement = _
"CREATE MEMBER CURRENTCUBE." + Parent + ".[" + MeasureName + "] AS '" + _
MDXStatement + "', SOLVE_ORDER=" + Str(SolveOrder) + ", FORMAT_STRING='" + _
FormatStr + "', VISIBLE=" + VisibleFlag
Set Command = Nothing // test
Recs.MoveNext
Loop
Recs.Close
Set Recs = Nothing // test
Cube.Update
Set Cube = Nothing // test
the lines marked with "//test" are inserted later to try if they help, but they doesn't.
what can be the reason of this memory leak? how to work around it?
many thanks in advance
Krisztian Pinter