Пример #1
0
void RoxieSimpleInputRowArray::kill()
{
    if (rows)
    {
        for (rowidx_t i = firstRow; i < numRows; i++)
            ReleaseRoxieRow(rows[i]);
        firstRow = 0;
        numRows = 0;
        ReleaseRoxieRow(rows);
        rows = NULL;
    }
}
Пример #2
0
void RoxieOutputRowArray::kill()
{
    clearRows();
    maxRows = 0;
    ReleaseRoxieRow(rows);
    rows = NULL;
}
Пример #3
0
void OwnedRowArray::clearPart(aindex_t from, aindex_t to)
{
    aindex_t idx;
    for(idx = from; idx < to; idx++)
        ReleaseRoxieRow(buff.item(idx));
    buff.removen(from, to-from);
}
Пример #4
0
void RoxieOutputRowArray::clearRows()
{
    for (rowidx_t i = firstRow; i < numRows; i++)
        ReleaseRoxieRow(rows[i]);
    firstRow = 0;
    numRows = 0;
    commitRows = 0;
}
Пример #5
0
bool DynamicRoxieOutputRowArray::ensure(rowidx_t requiredRows)
{
    unsigned newSize = maxRows;
    //This condition must be <= at least 1/scaling factor below otherwise you'll get an infinite loop.
    if (newSize <= 4)
        newSize = requiredRows;
    else
    {
        //What algorithm should we use to increase the size?  Trading memory usage against copying row pointers.
        // adding 50% would reduce the number of allocations.
        // anything below 32% would mean that blocks n,n+1 when freed have enough space for block n+3 which might
        //   reduce fragmentation.
        //Use 25% for the moment.  It should possibly be configurable - e.g., higher for thor global sort.
        while (newSize < requiredRows)
            newSize += newSize/4;
    }

    const void * * newRows;
    try
    {
        newRows = static_cast<const void * *>(rowManager->allocate(newSize * sizeof(void*), RowArrayActivityId));
        if (!newRows)
            return false;
    }
    catch (IException * e)
    {
        //Pahological cases - not enough memory to reallocate the target row buffer, or no contiguous pages available.
        unsigned code = e->errorCode();
        if ((code == ROXIE_MEMORY_LIMIT_EXCEEDED) || (code == ROXIE_MEMORY_POOL_EXHAUSTED))
        {
            e->Release();
            return false;
        }
        throw;
    }

    //Only the writer is allowed to reallocate rows (otherwise append can't be optimized), so rows is valid outside the lock
    const void * * oldRows = rows;
    {
        RoxieOutputRowArrayLock block(*this);
        oldRows = rows;
        memcpy(newRows, oldRows+firstRow, (numRows - firstRow) * sizeof(void*));
        numRows -= firstRow;
        commitRows -= firstRow;
        firstRow = 0;
        rows = newRows;
        maxRows = RoxieRowCapacity(newRows) / sizeof(void *);
    }

    ReleaseRoxieRow(oldRows);
    return true;
}
Пример #6
0
void RoxieRowBlock::operator delete (void * ptr)
{
    ReleaseRoxieRow(ptr);
}
Пример #7
0
void RoxieRowBlock::releaseRows()
{
    while (readPos < writePos)
        ReleaseRoxieRow(rows[readPos++]);
}
Пример #8
0
 virtual void releaseRow(const void * row)
 {
     ReleaseRoxieRow(row);
 }
Пример #9
0
void CRHRollingCacheElem::set(const void *_row)
{
    if (row)
        ReleaseRoxieRow(row);
    row = _row;
}
Пример #10
0
CRHRollingCacheElem::~CRHRollingCacheElem()
{
    if (row)
        ReleaseRoxieRow(row);
}
Пример #11
0
void OwnedRowArray::replace(const void * row, aindex_t pos)
{
    ReleaseRoxieRow(buff.item(pos));
    buff.replace(row, pos);
}
Пример #12
0
//OwnedRowArray
void OwnedRowArray::clear()
{
    ForEachItemIn(idx, buff)
        ReleaseRoxieRow(buff.item(idx));
    buff.kill();
}