v2.4.2.4 fails to retrieve image from camera - memory error

Three times tonight I got the following memory error after the exposure was completed and SGP tried to download the image from the camera. Previously I managed to capture 6 subs, then the error occurred so I close SGP and restart the program. Re-starting the session, the first image download was OK, the second failed again (this log extract referrs to that particular failure). If I do not re-start the program the next image download will always fail without exception.

Not sure what is causing the ‘out of memory’ error, this machine is Win7-64 with 32GB RAM. Numerous other programs running though. If you want the entire log I will have to upload separately.

[11/08/2015 02:08:45] [DEBUG] [Sequence Thread] Distance stayed below 2.5 for 0 seconds, done settiling…
[11/08/2015 02:08:45] [DEBUG] [Sequence Thread] Auto guider has settled…
[11/08/2015 02:08:45] [DEBUG] [Sequence Thread] Finished sending frame capture. Entering wait mode…
[11/08/2015 02:08:45] [DEBUG] [Camera Thread] SGM_CAMERA_CAPTURE message received…
[11/08/2015 02:08:45] [DEBUG] [Camera Thread] SetAscomNormalSpeed…
[11/08/2015 02:08:45] [DEBUG] [Camera Thread] Readout speed set to NORMAL…
[11/08/2015 02:27:31] [DEBUG] [Main Thread] User requested sequence pause…
[11/08/2015 02:28:45] [DEBUG] [Sequence Thread] Waking from exposure time sleep period…
[11/08/2015 02:28:45] [DEBUG] [Sequence Thread] Checking to see if the CCD has a temp…
[11/08/2015 02:28:45] [DEBUG] [Sequence Thread] Saving the CCD temp…
[11/08/2015 02:28:45] [DEBUG] [Sequence Thread] Entering super dangerous loop to await image completion…
[11/08/2015 02:28:56] [DEBUG] [Camera Thread] ASCOM Camera : Exception of type ‘System.OutOfMemoryException’ was thrown.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at ASCOM.DriverAccess.MemberFactory.CallMember(Int32 memberCode, String memberName, Type[] parameterTypes, Object[] parms) in c:\ASCOM Build\Export\ASCOM.DriverAccess\MemberFactory.cs:line 294
at ASCOM.DriverAccess.Camera.get_ImageArray() in c:\ASCOM Build\Export\ASCOM.DriverAccess\Camera.cs:line 361
at ac.CaptureImage(Image image, SgMessage& abort)
[11/08/2015 02:28:56] [DEBUG] [Camera Thread] ASCOM Camera: Attempting to abort exposure…
[11/08/2015 02:28:56] [DEBUG] [Camera Thread] ASCOM Camera: Exposure aborted…
[11/08/2015 02:28:56] [DEBUG] [Camera Thread] Error while attempting to capture frame…
[11/08/2015 02:29:07] [DEBUG] [Camera Thread] SGM_CAMERA_CAPTURE complete…
[11/08/2015 02:29:12] [DEBUG] [Sequence Thread] ASCOM Camera: Attempting to abort exposure…
[11/08/2015 02:29:12] [DEBUG] [Sequence Thread] ASCOM Camera: Exposure aborted…
[11/08/2015 02:29:12] [DEBUG] [Sequence Thread] Run event requested sequence abort…
[11/08/2015 02:29:12] [DEBUG] [Sequence Thread] Clearing timed monitoring events…
[11/08/2015 02:29:12] [DEBUG] [Sequence Thread] Checking RunEndOfSequenceEquipmentOptions, force = False
[11/08/2015 02:29:12] [DEBUG] [Sequence Thread] Sequence was aborted, skipping end of sequence options…

I think that this is not an SGPro error so I don’t really know. The error is generated by your camera’s driver at get_ImageArray()… SGPro is just delivering it to you so you have some idea of what’s going on. I would report the entire ASCOM exception the driver’s author and ask if they have any ideas.

Shouldn’t really be a RAM issue. It’s possible that the SGPro process itself is exceeding the amount of memory Windows is willing to allocate to a single process. Are you, by chance, running a sequence in which each new frame from the camera gets its own window?

No I re-use the single window for image download but there are several image target windows open (i.e., images from the Frame & Mosaic Wizard).

ChrisH

Ya… several shouldn’t matter. 40 might. If you can get it to happen regularly, can you use Task Manager to give us an idea of memory consumption by the SGPro process?

Did it again tonight, checked Task Manager and it was 696,584k. I restarted SGP and checked again and memory usage was 614,752k.

Wait a minute… one change I made recently was to enable Image History. I’ve just disabled it again to see if SGP behaves itself without it enabled.

Wow… that’s really high. SGPro typically, on start occupies, 28MB of RAM. What all do you have going on when SGPro opens? When you say “open”, do you mean SGPro open or you opened a sequence?

I mean I close and re-start the program (SGP does not crash because of this error but I know from experience if I try to capture another sub after this error first appears then all subsequent captures will also fail).

Lots of stuff running, mainly
Cumulus
FireFox
Outlook
PHD2
Excel
MS LifeCam
plus many background processes.

Plenty of RAM spare though, 6.8GB used out of the 32GB physical.

OK. Well typically, regardless of how much RAM you have, individual processes are limited to 2 GB of memory (this can be extended by the user). While I am concerned that SGPro is occupying 650MB of RAM on your machine, I would still run this by your camera driver’s author.

Well there is weird stuff going on. When I disabled Image History I noted within the history are listed dozens of Frame and Focus images - should they really be in there? Since disabling it SGP has not thrown the original error I reported again. However, Ive been keeping an eye on the memory usage and it’s now up to 754Mb. Immediately after finishing downloading an image the memory usage increases (over a period of a minute or so) by about 100Mb, then suddenly drops back again to a level 32Mb above previous, where it stays until the next image download. So basically, the memory usage is increasing by 32Mb per image.

That seems pretty normal. Your images are probably about 16MB each. We keep the original and stretched copy in memory (32 MB). We also keep the last 4 images in memory… So SGPro can climb to to ~150-200MB. I cant say I’ve ever seen it as high as you are reporting and Im not sure what is contributing to it. Is it a long running sequence? Can you send it for inspection?

To answer this question… yes. This is a feature to help folks perform manual focus operations (SGPro does not cache FF images though). All image history categories, FF included, are limited to 25 images, then we start pushing the oldest ones out.

OK, more on this memory behaviour…

When I first open SGP it occupies 42MB of RAM

Opening my sequence (18 targets underway at different stages, plus a variety of darks and flat sequences!) then memory usage goes up to about 700MB.If I close all the target image windows memory usage drops to only 541MB where it stays.

Thing is, there are a lot of taget images created by Frame and Mosaic Wizard in there, but even if I close all those image windows I don’t recover all the memory used, and when I delete a completed target from the sequence it does not delete the accompanying target image, there are some images in there from quite some time ago which I can’t get rid of.

You need to delete those images manually. Even so I doubt they are the problem. The problem is having a sequence with many targets. This does take a great deal of memory.

In the future, we have it on the backlog to be more memory conscious for sequences with many targets. For now we can’t do much to help.