To provide additional information, we are using the below logic to fetch values
PISDK.IPIData2 ipidata = snapPoint.Data as PISDK.IPIData2;
if (ipidata != null)
osiPIValues = ipidata.InterpolatedValues2(stDate.ToLocalTime(), endDate.ToLocalTime(), interval.TotalSeconds + "s");
1 of 1 people found this helpful
Have a look at the thread at PI SQL Commander throws an error when retrieving huge amount of query results data into file - this will give you some clues into this error message.
What is the time range over which you are trying to get these interpolated values? I'm thinking that your code is possibly returning too large a dataset to fit into the available memory allocated for the SAFEARRAY struct created by the PI-SDK.
Is this legacy code that you are modifying? If not, is there a specific reason you are doing this with PI-SDK as opposed to AFSDK?
Hi John, thanks for your reply.
We are fetching data for a day, with a sampling interval of 2 secs. In total, it would fetch around 43K data points. Is it a big number for SAFEARRAY struct to handle.
If so, Is there way to troubleshoot and identify how much memory is it taking or is there any mechanism to track this. Is there any possibility to overwrite the memory it can handle?
As you mentioned, this is legacy code, which we are maintaining at the moment.
I wouldn't have thought that returning such a small volume of data would be a problem, and certainly not cause an out of memory exception, so there will be something else at play. Do you know if the data you are trying to retrieve is annotated at all?
You can try using PISDK Trace to troubleshoot this issue - try starting with a trace level of 10 and a depth of "wire calls".
2 of 2 people found this helpful
I could make the same request for 1 day @ 2s interval to InterpValues2 and have it return the 43k events ok from sinusoid tag. 10 days @ 2s also worked fine for me. I would try to understand how your application is using memory up to that call using a perfmon dataset to record the memory usage. Is it something you can reproduce with a test PISDK code outside of this application with the exact same parameters? Does it depend on the tag referenced?