Crashing out the box with matrix struct in IDL

2 posts / 0 new
Last post
Offline
Last seen: 8 months 1 week ago
Joined: 01/20/2020
Posts: 1
Crashing out the box with matrix struct in IDL

Hello,

I am attempting to send images across DDS, to do so I'd like to make a struct comprising of just a matrix. In the IDL I'm doing

    struct imgType{
        unsigned long imgMat[1224][1025];
    };

This gets generated just fine, and builds just fine. However, upon running it, the debugger stops me with an error of 'stack overflow' before it even reaches the publishing function. Anyone have any clue why this is happening? It doesn't happen when I use sequences, but I am unsure on how to even use those in DDS.

I am using C++ on Visual Studio 2017.

irwin's picture
Offline
Last seen: 2 months 1 week ago
Joined: 08/14/2010
Posts: 42

I can duplicate your test case.

Looking closer the error is triggered by the use of the _chkstk(). That insures that the local variables do not exceed 8k. Well all the oblects following in publishing_main are indeed declared on the local stack. In order to get around this you need to declare pointers. I corrected the tes_publisher to use heap and not stack variables. Now the writer is able to write. You will also have to do similiar things in you subscribing application. My guess is that I over achieved. Most likely it was just the declaration of the imgType sample statement(line 57) that was causing you grief. That object is 5 MB in size. Whereas the inage of the sequence is minimal. When you add date to it, it is on the heap and not your local stack.

                                         Irwin

                   Irwin.

File Attachments: