API Support Forum
OEC API > API Support > Exception of type 'System.OutOfMemoryException' was thrown.
Author Topic: Exception of type 'System.OutOfMemoryException' was thrown.
(4 messages, Page 1 of 1)
Moderators: VPfau
SierraChart
Posts: 111
Joined: Jul 17, 2007


Posted: Sep 19, 2007 @ 03:45 PM             Msg. 1 of 4
I'm getting the OnError callback with the following error message:
Exception of type 'System.OutOfMemoryException' was thrown.

What I believe I did to cause this was the following: subscribe to a contract using SubscribeTicks, then request historical tick data for the same contract by using RequestTicks. I got one tick from the subscription, then I received the historical data, and after that I started receiving this error. The error seems to occur with the same sort of frequency as I'd expect to receive real-time tick data, and I'm not receiving any more tick data.

Is there anything I'm doing wrong here? I don't request historical tick data with SubscribeTicks because I need to request subscriptions separately from downloads.
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Sep 19, 2007 @ 04:07 PM             Msg. 2 of 4
could you please inspect the Exception object passed to OnError callback and look at the stack trace of this exception?

If you can provide us result of ex.ToString() call for this exception object, we probably will be able to find what the problem is.
SierraChart
Posts: 111
Joined: Jul 17, 2007


Posted: Sep 19, 2007 @ 05:38 PM             Msg. 3 of 4
The exception object didn't have a stack trace, however I traced the exception back to my own code using the debugger. I wasn't expecting OnError to be called for an exception in my own code, but that makes sense because the exception still happened within the OnTicksReceived callback. Sorry for bringing this up. Everything is working as I expected now.
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Sep 20, 2007 @ 08:31 AM             Msg. 4 of 4
OnError could be called when uncaught exception occurs in user code, and then caugth in API code - i.e. in user's event handlers.

if you want to avoid this, I'd recommend to catch exceptions in your event handlers.