Support Board
Date/Time: Fri, 07 Feb 2025 06:47:05 +0000
Post From: Correct use of SCFloatArrayArray for better memory management
[2020-05-22 18:17:48] |
DonMattez - Posts: 8 |
Hello, i am using following code to save Information about lower highs and higher lows in the available subgraph arrays: SCFloatArrayArray GetBarValuesForOpening(SCStudyInterfaceRef sc, int InArraySize) { SCFloatArrayArray SCMaxValues = sc.Subgraph[0].Arrays; for (int i = 0; i <= InArraySize; i++) { SCMaxValues[i][0] = sc.BaseDataIn[SC_LOW][sc.Index - InArraySize + i]; //Minimum at the Xth bar SCMaxValues[i][1] = sc.BaseDataIn[SC_HIGH][sc.Index - InArraySize + i]; //Maximum at the Xth bar } return SCMaxValues; } The function is called from: const int InCheckBars = sc.Input[0].GetInt(); //lets say it is 3 SCFloatArrayArray SCMaxValues = sc.Subgraph[0].Arrays; //some more code SCMaxValues = GetBarValuesForOpening(sc, InCheckBars); Do i need to free the memory after using SCFloatArrayArray? Everytime I call the replay function and afterwars stop it, after recalculation the process memory rises a little bit. It should be returning to original values after stopping a replay, but it doesn't get there totally. In other words: if I call the replay function lets say 20 times and stop it, the process memory fills up. I have disconnected from the data to not generate more bars outside of the replay, and the replay itself is always calculated from the same time. Shouldn't all data be freed after stopping a replay? I hope I could explain well, I have still a lot to learn for programming. Thanks in advance. |