Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 18:10:41 +0000



Sierra crash on multiple charts using Dynamic Memory Allocations Within Study Instance

View Count: 853

[2015-06-08 20:56:56]
wwwingman - Posts: 185
Hi

I need persistence between study call so followed the instructions in the documentation on the Dynamic Memory Allocations Within Study Instance.
( http://www.sierrachart.com/index.php?page=doc/doc_ACSILProgrammingConcepts.html#DynamicMemoryAllocations ).

However, something seem to go wrong when I use the DLL on multiple charts. And it crashes SierraCharts.

Here is the simples sequence that systematically crashes my sierra :
1. Compile the a skeleton with the code below (The code comes from the documentation, I have not modified it).
2. Open Chart #1. Add the skeleton DLL.
3. Duplicate Chart #1 (=> Chart #2).
4. Close Chart #1.
5. Close Chart #2.
6. Sierra crashes.

Tested on 1259 and 1261 versions.

Please advise.

-- W.

The code of the skeleton :

#include "sierrachart.h"

SCDLLName("SierraSkeleton")

SCSFExport scsf_DynamicMemoryAllocationExample(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "Dynamic Memory Allocation Example";
    sc.AutoLoop = 1;

    sc.FreeDLL = 0;

    return;
  }

  double * p_DoubleArray = (double*)sc.GetPersistentPointer(1);

  if(sc.LastCallToFunction)
  {
    if(p_DoubleArray != NULL)
    {
      sc.FreeMemory( p_DoubleArray);
      sc.SetPersistentPointer(1, NULL);
    }

    return;
  }

  if(p_DoubleArray == NULL)
  {
    p_DoubleArray = (double *) sc.AllocateMemory( 1024 * sizeof(double) );

    if(p_DoubleArray != NULL)
      sc.SetPersistentPointer(1, p_DoubleArray);
    else
      return;
  }

  p_DoubleArray[0] = 100;

  return;
}

Date Time Of Last Edit: 2015-06-08 20:57:38
[2015-06-09 01:52:35]
Sierra Chart Engineering - Posts: 104368
This problem will be solved in the next release. The persistent data had to be cleared when copying a chart.
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

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

Login

Login Page - Create Account