Assertion failled resizing vectors in plug-in algorithms

Discussion in 'microsoft.public.sqlserver.datamining' started by Claudio Curotto, Apr 25, 2007.

  1. I got an Assertion failed error while resizing a vector in my plug-in algorithm.

    In order to isolate the problem I created a simple model class in Algorithm.h file as shown below:

    //========================= begin code =======================

    class CStateStats
    {
    public:
    DOUBLE m_dblSum;
    DOUBLE m_dblSqrSum;
    public:
    CStateStats()
    {
    m_dblSum = 0.0;
    m_dblSqrSum = 0.0;
    }
    };

    class CAttStats : public DMHALLOC
    {
    public:
    dmh_vector<CStateStats> vstatestats;
    public:
    CAttStats() : vstatestats (*this)
    {
    }
    };

    //========================= end code =======================

    The access to DMHALLOC is provided in that class and in Algorithm class as shown below:

    //========================= begin code =======================

    class ATL_NO_VTABLE ALGORITHM :
    public CComObjectRootEx<CComMultiThreadModel>,
    public CComCoClass<ALGORITHM, &CLSID_ALGORITHM>,
    public ISupportErrorInfo,
    public IDMAlgorithm,
    public IDMPersist,
    public DMHALLOC
    {
    public:
    ALGORITHM(): _vCAttStats (*this)

    //========================= end code =======================


    I succeded making room for _vCAttStats vector, but when I tried providing room for the vectors of the vector I got an Assertion failed error (file dmhallocator.h Line:56 Expression assert(_dmhalloc._spidmmemoryallocator != NULL)). Please, see the code below, included in NAVIGATOR::GetNodeArrayProperty function:

    //========================= begin code =======================

    dmh_vector<CAttStats>& lrp_vCattstats = _palgorithm->_vCAttStats;

    lrp_vCattstats.clear();
    CHECK_STL_MEM(lrp_vCattstats.resize (2)); // <<<<< succeed here!
    // make space for the states
    CHECK_STL_MEM(lrp_vCattstats[0].vstatestats.resize(ulStates)); // <<<<<<< assertion failed here!


    //========================= end code =======================


    I would apreciate any help.

    Claudio
     
    Claudio Curotto, Apr 25, 2007
    #1
    1. Advertisements

  2. Bogdan Crivat [MSFT], May 3, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.