MaxImDL Heap Corruption when returning data from ASCOM Camera Driver

Discussion in 'Demo User Tech Support' started by Scott Thompson, May 23, 2018.

  1. Scott Thompson

    Scott Thompson Standard User

    May 23, 2018

    I am new to MaxIm and ASCOM... and I have written an ASCOM Camera driver for an Andor Zyla camera. I used the latest ASCOM and ASCOM C# Driver Template and have the latest MaxIm DL as well. Note that I am using the Demo version of MaxImDL at the moment.

    When starting an Exposure from MaxImDL, I can see from the the driver tracelog MaxImDL is getting to the point where MaxIMDL is trying to get the ImageArray. At that point, MaxImDL crashes. Opening the MSVS debugger allows me to see that MaxImDL is experiencing Heap Corruption. I can continue on and MaxImDL gets the data and displays the image just fine. And subsequent Exposure calls will also be successful, albeit with these Heap exceptions along the way. (Image of Heap Corruption Dialog attached.)

    I have tried several different ways of allocating and returning the ImageArray. I found several on the web from other ASCOM camera drivers. They all fail the same way and the exception is always at the same place in MaxImDL.

    The ASCOM Driver Test Project works fine and I can export the ImageArray data to a file after an Exposure, etc.

    I downloaded PhD2 and used my ASCOM driver and camera and it was able to acquire images without any issues (no heap corruption, etc.).

    Anyone else see this sort of thing? It may not be specifically related to the Exposure method, but that seems to be the only way I can get it to fail.

    Thanks in advance for any insights/suggestions.


    Attached Files:

  2. Owen Lawrence

    Owen Lawrence Retired Staff

    Oct 1, 2014
    Hi Scott,

    This was just brought to my attention. Can you please provide the log you mentioned?

    It's important to ensure that ImageArray is actually ready and available before it is accessed. MaxIm DL honours a protocol signalled by changes to the CameraState property, but it also checks "ImageReady" while exposing. Make sure you do not report "ImageReady" before there's actually a buffer available, or MaxIm DL will try to access it anyway.

    - Owen -

Share This Page