Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 06:20:30 +0000



Kiwi Resync Study - Memory leak?

View Count: 3902

[2018-02-27 21:33:31]
samual sprat - Posts: 343
Hi All,

Not sure if it's a result of the 64bit update or if it was there before (32bit was obviously memory limited to 4GB so may have hidden this issue), but when I use Kiwi Resync to refresh the study data on my chart the Commit Charge increases until my Virtual Memory is full. As soon as I remove the study the slow but incremental increase in memory usage stops straight away. I have 32GB of RAM and within 12 hours applications start to crash and Sierra is using 40GB+. Eventually I need to reboot my machine. Any idea if this is a code issue? I've posted the original Kiwi code that was remote compiled by Sierra below. FYI I'm running 64bit Sierra (1706) on Windows 10 Creator latest release.


#include "sierrachart.h"
SCDLLName("* Kiwi's Stuff 2015 *")


/*==========================================================================*/
SCSFExport scsf_RecalcChart(SCStudyInterfaceRef sc) {
  if (sc.SetDefaults) {
    sc.GraphName = "Recalc";
    sc.StudyDescription = "Recalc Chart every x secs based on real time";
    sc.Subgraph[0].Name = "Strobe";
    sc.Subgraph[1].Name = "Time";
    sc.Subgraph[0].DrawStyle=DRAWSTYLE_IGNORE;
    sc.Subgraph[1].DrawStyle=DRAWSTYLE_IGNORE;
    sc.Input[0].Name="Seconds between recalcs";
    sc.Input[0].SetInt(60);
sc.UpdateAlways=1;
    sc.FreeDLL = 1;
    return;
  }

  if (sc.CurrentSystemDateTime.GetTime() % sc.Input[0].GetInt() == 0) {
    if (sc.Subgraph[0][sc.ArraySize-1] < 999660) {
      sc.Subgraph[0][sc.ArraySize-1] = 999666;
      sc.Subgraph[1][sc.ArraySize-1] = sc.CurrentSystemDateTime.GetTime();
      sc.FlagFullRecalculate = 1;
    }
  }
  else
    sc.Subgraph[0][sc.ArraySize-1] = 0;
}
Date Time Of Last Edit: 2018-02-27 21:35:43
[2018-02-27 23:10:30]
Sierra Chart Engineering - Posts: 104368
It definitely does sound like you are using some custom study which is using more and more memory.
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: 2018-02-27 23:10:39
[2018-02-28 12:00:14]
samual sprat - Posts: 343
Any idea what could be causing it? I wish I had the ACSIL knowledge to work it out. Code is not very long

Thanks
S
[2018-03-03 09:23:29]
@sstfrederik - Posts: 403
sunny,

I had similar issues with one of my custom studies for one of my clients when we were testing things. What worked for me was to always deploy a dll compiled for operational use.

You can try and do the following:

In the source code set:

sc.FreeDLL = 0;

recompile and try the new dll again.


Hope this helps.

Frederik
[2018-03-03 11:43:09]
samual sprat - Posts: 343
You're a legend, Frederick - Worked perfectly! Cheers
[2018-09-03 20:26:43]
samual sprat - Posts: 343
Hey all. Anyone using kiwi's resync study and find it's not working anymore? It loads fine but doesn't refresh the chart.

I've tried to recompile the code in 1795 with the 'sc.FreeDLL = 0' fix to the original code from Frederik but no ball.
[2018-09-29 22:38:16]
Kiwi - Posts: 374
I'm not sure why you're using the study (it should only be needed if you have a dll that isn't really operating correctly) however here is an updated kiwi15 compiled with 1809 (32bit) and 1812 (64bit) using Sierra Chart's remote compiler.

I added an extra feature, the option to reload the data file if you want (set to No if you don't) in case there was an issue in that area:



/*==========================================================================*/
SCSFExport scsf_RecalcChart(SCStudyInterfaceRef sc) {
  if (sc.SetDefaults) {
    sc.GraphName = "Recalc";
    sc.StudyDescription = "Recalc Chart every x secs based on real time";
    sc.Subgraph[0].Name = "Strobe";
    sc.Subgraph[1].Name = "Time";
    sc.Subgraph[0].DrawStyle=DRAWSTYLE_IGNORE;
    sc.Subgraph[1].DrawStyle=DRAWSTYLE_IGNORE;
    sc.Input[0].Name="Seconds between recalcs";
    sc.Input[0].SetInt(60);
    sc.Input[1].Name="Also reload chart data";
    sc.Input[1].SetYesNo(0);

sc.UpdateAlways=1;
sc.FreeDLL = 1;
    return;
  }

  if (sc.CurrentSystemDateTime.GetTime() % sc.Input[0].GetInt() == 0) {
    if (sc.Subgraph[0][sc.ArraySize-1] < 999660) {
      sc.Subgraph[0][sc.ArraySize-1] = 999666;
      sc.Subgraph[1][sc.ArraySize-1] = sc.CurrentSystemDateTime.GetTime();
      sc.FlagFullRecalculate = 1;
      if (sc.Input[1].GetYesNo()) sc.FlagToReloadChartData = 1;
}
else
sc.Subgraph[0][sc.ArraySize-1] = 0;
}
}

Date Time Of Last Edit: 2018-09-29 22:39:59
attachmentkiwi15.cpp - Attached On 2018-09-29 22:37:02 UTC - Size: 15.62 KB - 499 views
attachmentkiwi15.dll - Attached On 2018-09-29 22:37:22 UTC - Size: 832.5 KB - 467 views
attachmentkiwi15_64.dll - Attached On 2018-09-29 22:37:39 UTC - Size: 862.5 KB - 463 views
[2018-10-14 02:01:22]
Sierra Chart Engineering - Posts: 104368
We realize the problem with the extra memory use by the study is some operating system level issue related to:
sc.FreeDLL = 1;


We are working on a solution to this, this week.
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: 2018-10-14 02:01:38
[2019-03-14 10:56:54]
User13668 - Posts: 291
SC: re post #9 - did you resolve this?
[2019-03-14 17:06:14]
Sierra Chart Engineering - Posts: 104368
Yes this has been resolved months ago.
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: 2019-03-14 17:06:20
[2019-03-18 07:04:27]
ILIM KIRGIZ - Posts: 187
Hi Kiwi,
I'm using this study because I have an issue with historical charts(attached screenshot shows it) when I put my computer into sleep mode and wake it up.
I tried to compile this code with version 1882 32bit but I've got below error.
What would be your suggestion to overcome this?
Thanks.

The remote build did not succeed. Result:

Resync_kiwi15.cpp: In function 'void scsf_TrueLive_2014(SCStudyInterfaceRef)':
Resync_kiwi15.cpp:82:22: error: 'struct s_sc' has no member named 'PersistVars'
int& seqno = sc.PersistVars->i1;

^
Resync_kiwi15.cpp:83:22: error: 'struct s_sc' has no member named 'PersistVars'
int& tnsno = sc.PersistVars->i2;

^
Resync_kiwi15.cpp:84:5: error: 'SCTimeAndSalesArray' was not declared in this scope
SCTimeAndSalesArray TSArray;

^
Resync_kiwi15.cpp:85:24: error: 'TSArray' was not declared in this scope
sc.GetTimeAndSales(TSArray);

^
Resync_kiwi15.cpp: In function 'void scsf_TrueLive_2014pvm(SCStudyInterfaceRef)':
Resync_kiwi15.cpp:248:22: error: 'struct s_sc' has no member named 'PersistVars'
int& seqno = sc.PersistVars->i1;

^
Resync_kiwi15.cpp:249:22: error: 'struct s_sc' has no member named 'PersistVars'
int& tnsno = sc.PersistVars->i2;

^
Resync_kiwi15.cpp:250:5: error: 'SCTimeAndSalesArray' was not declared in this scope
SCTimeAndSalesArray TSArray;

^
Resync_kiwi15.cpp:251:24: error: 'TSArray' was not declared in this scope
sc.GetTimeAndSales(TSArray);

^

-- End of Build -- 06:57:23
imagescreenhot.JPG / V - Attached On 2019-03-18 07:02:55 UTC - Size: 197.31 KB - 416 views
[2019-03-18 07:20:46]
Sierra Chart Engineering - Posts: 104368
We will create a new built-in study to accomplish the same thing. Just give us a couple of days.
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
[2019-03-18 07:46:24]
Kiwi - Posts: 374
Long term you should use Sierra E's version.

In the mean time this (an entire file with only this function) compiles using remote compile. The source file (cpp) and the 64bit version of the dll are attached. I didn't set scFreedll so it will default to zero - now that you can free the dll with the Build function its not as important as it used to be.

#include "sierrachart.h"

SCDLLName("* Test Kiwi *")

/*==========================================================================*/
SCSFExport scsf_RecalcChart(SCStudyInterfaceRef sc) {
if (sc.SetDefaults) {
sc.GraphName = "Recalc";
sc.StudyDescription = "Recalc Chart every x secs based on real time";
sc.Subgraph[0].Name = "Strobe";
sc.Subgraph[1].Name = "Time";
sc.Subgraph[0].DrawStyle=DRAWSTYLE_IGNORE;
sc.Subgraph[1].DrawStyle=DRAWSTYLE_IGNORE;
sc.Input[0].Name="Seconds between recalcs";
sc.Input[0].SetInt(60);
sc.Input[1].Name="Also reload chart data";
sc.Input[1].SetYesNo(0);

sc.UpdateAlways=1;
return;
}

if (sc.CurrentSystemDateTime.GetTime() % sc.Input[0].GetInt() == 0) {
if (sc.Subgraph[0][sc.ArraySize-1] < 999660) {
sc.Subgraph[0][sc.ArraySize-1] = 999666;
sc.Subgraph[1][sc.ArraySize-1] = sc.CurrentSystemDateTime.GetTime();
sc.FlagFullRecalculate = 1;
if (sc.Input[1].GetYesNo()) sc.FlagToReloadChartData = 1;
}
else
sc.Subgraph[0][sc.ArraySize-1] = 0;
}

}

Date Time Of Last Edit: 2019-03-18 07:48:15
attachmentKiwi_test.cpp - Attached On 2019-03-18 07:43:40 UTC - Size: 1.16 KB - 420 views
Private File
[2019-03-18 17:35:57]
Willson - Posts: 176
Off topic, sorry.
Been wanting Kiwi input for 2 years re update Kiwi12.dll v868 to 64 bit. In Particular,
study item named "T1". Can anyway be found to do this by a non-programmer. I cannot use 64 bit till I get this updated. I don't know how to communicate with Kiwi.
my email: baxter_1762@protonmail.com.
[2019-03-18 19:14:05]
User90125 - Posts: 715
I don't know how to communicate with Kiwi.

Try requesting to send him a Direct Message >> https://www.sierrachart.com/SupportBoard.php?do=UserProfile&UserID=46
[2019-03-18 21:58:09]
Willson - Posts: 176
User 212764 Thanks for way to reach Kiwi. I have never used Direct Message to a specific user. I can;t find instructions for this feature, but doing it from your link above.
[2019-03-18 22:20:39]
Kiwi - Posts: 374
I don't remember a study called T1 but it sounds like some sort of moving average.

Does anyone have a link to the old support board so I can have a search around for it?
[2019-03-18 22:30:39]
Kiwi - Posts: 374
No. I found a link. And I even found the old kiwi12 source.

Can you post an image of what you get from F6 and then what you get when you open the study settings of this T1. I wonder if its the VC ("Stendahl's Value Chart") from kiwi12 where subgraph 10 is labelled T1.
[2019-03-18 23:54:18]
Willson - Posts: 176
Ok The Study is named TI, not T1, It slices part of a signal and displays it. I use it to slice certain portions of $Tick and then use the sliced out amplitude in other charts. I cant seem to get images to display in this reply. (never done it before) Internal parameters to set are CutOff1, and CutOff2. That is all. I could send images thru email if feasible. OK now that I posted, I see the image.
Date Time Of Last Edit: 2019-03-18 23:56:05
imageKiwi studies 2012.jpg / V - Attached On 2019-03-18 23:49:42 UTC - Size: 40.2 KB - 421 views
[2019-03-19 05:39:48]
Kiwi - Posts: 374
OK. I found it here

Kiwi Resync Study - Memory leak?

I added it to kiwi_test.cpp & compiled it for 64 bit. I would imagine it should behave the same way as it used to but its years since I looked at it so you'll need to test it.
attachmentKiwi_test.cpp - Attached On 2019-03-19 05:36:35 UTC - Size: 3.27 KB - 411 views
attachmentKiwi_test_64.dll - Attached On 2019-03-19 05:37:28 UTC - Size: 839 KB - 397 views
[2019-03-19 12:55:14]
Sierra Chart Engineering - Posts: 104368
In the next version of Sierra Chart which we are putting out now, there is a Chart Recalculation-Periodic study.
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
[2019-03-19 17:03:37]
Willson - Posts: 176
ok appreciate, but not knowledgeable how to load the (Kiwi_test_64.dll) to allow it to be used. I copied the dll into SC Data file (next to kiwi12. and restarted SC 32 bit. I don't find any reference to it in the Custom Studies or regular studies. What am I missing?
[2019-03-19 20:35:31]
@sstfrederik - Posts: 403
You will need to run the SC 64 bit version (SierraChart_64.exe). Than the _64.dll studies will show in the custom study list. If the study is added to your SC data folder.
Date Time Of Last Edit: 2019-03-19 20:36:08
[2019-03-20 00:36:22]
Willson - Posts: 176
Sending a forbidden BIG thankyou to Kiwi, sstfrederik,user212764 all that helped a lame programmer thru this. It now works

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account