Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. CSampleQueue memory deallocation

CSampleQueue memory deallocation

Scheduled Pinned Locked Moved C++ Gurus
2 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AAnil
    wrote on last edited by
    #1

    I have a code like below
    Where RB_ANALOGTOOL_MAXNUMCHANNELS = 18;

    cSampleQueue m_QueuesDig[RB_ANALOGTOOL_MAXNUMCHANNELS];

    for(int k=0; k<RB_ANALOGTOOL_MAXNUMCHANNELS; k++)
    {
    m_QueuesDig[k] = new cSampleQueue(0,-1);
    }

    for (int k=0; k<RB_ANALOGTOOL_MAXNUMCHANNELS; k++)
    {
    m_QueuesDig[k]->Clear();//line 3

    }*

    I want to know whether line 3 will deallocate the memory or just clear the data in each location.
    If it does not deallocate the memory let me know how it can be done.
    I am trying delete[] m_QueuesDig but getting violation."This may be due to a corruption of the heap,which indicates a bug in adtf_devenv.exe or any of the DLLs it has loaded".

    Can any one let me know some solution regarding above problem.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexisdm
      wrote on last edited by
      #2

      To be able to do that:
      @m_QueuesDig[k] = new cSampleQueue(0,-1);@

      you should define an array of pointers:
      @cSampleQueue *m_QueuesDig[RB_ANALOGTOOL_MAXNUMCHANNELS];@

      and then you'll be able to delete each one separately like this:
      @delete m_QueuesDig[k]@

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved