Support Board
Date/Time: Fri, 10 Jan 2025 16:39:57 +0000
Custom study with sierrachart functions : Memory leak
View Count: 1068
[2016-09-26 17:42:57] |
User612903 - Posts: 51 |
Hi, I've tested a little and simple custom dll, and i realise there is already a little leak of memory. Do i need to freeup some memory after calling your functions ? Or do i need to clean the SCSubgraphRef ? Thanks for helping. Here is my code : SCSFExport scsf_GlobalTrendlines(SCStudyInterfaceRef sc) { SCSubgraphRef SMA50 = sc.Subgraph[0]; SCSubgraphRef SMA200 = sc.Subgraph[1]; SCSubgraphRef ATRGRAPH = sc.Subgraph[2]; SCSubgraphRef ZIGZAG = sc.Subgraph[3]; //SCInputRef SMA50Length = sc.Input[0]; FOR SETTING // Set configuration variables if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "Global Trendlines"; sc.StudyDescription = ""; // Set the region to draw the graph in. Region zero is the main // price graph region. sc.GraphRegion = 0; sc.AutoLoop = 1; sc.AlertOnlyOncePerBar = true; // During development set this flag to 1, so the DLL can be modified. When development is completed, set it to 0 to improve performance. sc.FreeDLL = 1; //sc.AddMessageToLog("FK All set", 1); // Must return before doing any data processing if sc.SetDefaults is set return; } // only process at the close of the bar; if it has not closed don't do anything if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_NOT_CLOSED) { return; } //SMA50 SMA50.Name = "SMA50"; SMA50.PrimaryColor = COLOR_YELLOW; SMA50.DrawStyle = DRAWSTYLE_POINT; SMA50.LineWidth = 1; sc.SimpleMovAvg(sc.Close, SMA50, 50); //SMA200 SMA200.Name = "SMA200"; SMA200.DrawStyle = DRAWSTYLE_POINT; SMA200.PrimaryColor = COLOR_PURPLE; SMA200.LineWidth = 1; sc.SimpleMovAvg(sc.Close, SMA200, 200); //ATR GRAPH ATRGRAPH.Name = "XATR"; ATRGRAPH.DrawStyle = DRAWSTYLE_IGNORE; ATRGRAPH.LineWidth = 2; ATRGRAPH.PrimaryColor = COLOR_BLUE; sc.ATR(sc.BaseDataIn, ATRGRAPH, 400, MOVAVGTYPE_SIMPLE); //ZIGZAG ZIGZAG.Name = "ZIGZAG"; ZIGZAG.DrawStyle = DRAWSTYLE_LINE; ZIGZAG.LineWidth = 3; ZIGZAG.LineStyle = LINESTYLE_DOT; ZIGZAG.PrimaryColor = COLOR_PURPLE; sc.ZigZag2(sc.High, sc.Low, ZIGZAG, 2, 0.0003, sc.ArraySize - 500); return; } |
[2016-09-26 18:03:09] |
Sierra Chart Engineering - Posts: 104368 |
You can be assured that there is no interaction with ACSIL which will cause a memory leak. There is nothing special to do. There are certainly things you can do which could cause more memory to be used but it will be released at the appropriate time. There is nothing wrong with the code you posted. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2016-09-26 18:03:52
|
[2016-09-26 19:27:27] |
User612903 - Posts: 51 |
ok, thank you for coming back to me. Since I'm sure you are way more advanced than me in C++, does any of those code need to be completed by a cleanup for the memory to be relased ? std::string data_instrument = sc.Symbol.GetChars();
char buffer[500];
int &PersistentHigh1 = sc.GetPersistentInt(112);
const unsigned char* uniqid;
char *zErrMsg = 0;
As you understand I am trying to debug memory leak, but since the code from my first message is correct and the memory keep increasing slowly, it's hard for me to findout what's wrong in my code. Any tools you recommend ? Thank you |
[2016-09-26 19:39:16] |
Sierra Chart Engineering - Posts: 104368 |
None of this requires any cleanup. During real-time updating of a chart, there will be a small increase of memory over time. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2016-09-26 19:56:48] |
User612903 - Posts: 51 |
oh okay so this increase does not come from me. So the best would be to restart sierrachart every week for example, to reset the memory ? Or is there another option ? |
To post a message in this thread, you need to log in with your Sierra Chart account: