Login Page - Create Account

Support Board


Date/Time: Wed, 24 Apr 2024 12:34:37 +0000



Custom Study crashes only if loaded on startup

View Count: 902

[2015-11-04 03:37:57]
jwick - Posts: 142
I'm experiencing an unusual bug in a custom study of mine. If I load it onto a fresh chart, then open up settings, and keep changing different settings while hitting apply each time, no worries.

But, if I were to save this chart as a chartbook, exit Sierra Charts, and open that chartbook, the initial load is perfectly fine with the study plotting as expected. However, now if I open up the study settings, and start changing its settings and hitting apply, SC crashes / I get a CPU exception.

Not sure if you've encountered this before and would know why? I am using sc.GetPersistentPointer() and sc.setPersistentPointer() and am not using anything afaik that should cause persistence of data (other than study settings) between program loads.

Any advice / pointers appreciated!
[2015-11-04 04:18:39]
Sierra Chart Engineering - Posts: 104368
Follow the instructions here to perform step-by-step debugging:
http://www.sierrachart.com/index.php?page=doc/doc_DebuggingDLLs.html

In general to understand the source of a problem like this is not very simple.

What you describe is the result of accessing invalid memory or corrupting memory.

This information here may also be helpful:
http://www.sierrachart.com/index.php?page=doc/doc_ACSILProgrammingConcepts.html#DynamicMemoryAllocations

If you are allocating memory be sure to follow the current code examples and rely on the SC functions for that.

Otherwise, it is an impossibility for us to know specifically what is wrong unless we were to understand the code and perform step-by-step debugging.
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: 2015-11-04 04:19:15
[2015-11-04 14:53:21]
jwick - Posts: 142
Thanks for your suggestions. I'm trying to set everything up for debugging; however, every time I try to re-build my Debug configuration, I get an unresolved external symbol error (the Release configuration builds without issue).

Even though the VS setup instructions indicate otherwise, I played around with the project properties for the Debug configuration, and under C/C++ -> Code Generation -> Runtime Library, if I change it from /MT to /MTd, then the unresolved external symbol error disappears and the build succeeds. However, when I do that, there is a CPU exception every time I load the charts.
[2015-11-04 17:16:03]
Sierra Chart Engineering - Posts: 104368
Use /MDd or /MD.

The exception most likely is caused by some problem in your code. This is the whole idea behind step-by-step debugging. You can step through the code and see where it occurs.
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
[2015-11-06 22:06:32]
jwick - Posts: 142
hehehe :) As always, you are correct! Thanks for the tips. In hindsight, the source of the crash makes sense actually! I doubt it'll help anyone else but I'll mention it nonetheless. I was thinking ooo CPU excpetion ... I'm doing something wrong with persistent pointers. Keep re-reading my code without any progress. After debugging it, a silly silly oversight was the cause of the mistake - an uninitialized member (integer) in one of my very minor minor classes (I was using the variable to index into an array)! SO, when I load the study onto a fresh chart, that variable happens to always be initialized to 0 by the runtime. BUT, when the study is already set up in a chartbook, and I load that chartbook, that variable gets initialized to a random value! tsk tsk ... always explicitly initialize variables :P

Yay!
Date Time Of Last Edit: 2015-11-06 22:07:19

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

Login

Login Page - Create Account