Support Board
Date/Time: Wed, 27 Nov 2024 18:53:22 +0000
Post From: Dynamic Memory
[2023-07-23 22:47:07] |
WarriorTrader - Posts: 245 |
Hello, I have been getting intermittent CPU exception errors on a few studies after upgrading and suscept it is the dynamic arrays I am using. Should I be using sc.AllocateMemory() function? std::map<int, int> * LabelMemory = (std::map<int, int> *)sc.GetPersistentInt(1); if (LabelMemory == NULL) { LabelMemory = (std::map<int, int> *) new std::map<int, int>; if (LabelMemory != NULL) sc.SetPersistentInt(1,(int)LabelMemory); else return; } //----------------------------------------------------------------- struct p_VolumeSlice { int SliceAsk; //PriorLowAsk int SliceBid; int SlicePrice; int LimitOrderBid; //PriorPullBid int LimitOrderAsk; int MarketOrderBid; //PriorInitBid int MarketOrderAsk; int ResponsiveAll; //ResponsiveAll }; p_VolumeSlice * VolumeSlice = (p_VolumeSlice *)sc.GetPersistentInt(62); if ((VolumeSlice == NULL) && (ChartReversalNum !=0)) { VolumeSlice = (p_VolumeSlice *) new p_VolumeSlice[ChartReversalNum]; if (VolumeSlice != NULL) sc.SetPersistentInt(62,(int)VolumeSlice); else return; } I also replaced delete [] LabelMemory; with sc.FreeMemory(LabelMemory); Using SC Version 2525 Revision 26745. I initially upgraded to 2512 and got the problem so I upgraded again to 2525. --WT Date Time Of Last Edit: 2023-07-23 23:24:07
|