Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
RPageAllocator.cxx
Go to the documentation of this file.
1/// \file RPageAllocator.cxx
2/// \author Jakob Blomer <jblomer@cern.ch>
3/// \date 2019-06-25
4
5/*************************************************************************
6 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13
15
16#include <TError.h>
17
18#include <algorithm>
19
20ROOT::Internal::RPage ROOT::Internal::RPageAllocatorHeap::NewPage(std::size_t elementSize, std::size_t nElements)
21{
22 R__ASSERT((elementSize > 0) && (nElements > 0));
23 auto nbytes = elementSize * nElements;
24 auto buffer = new unsigned char[nbytes];
25 return RPage(buffer, this, elementSize, nElements);
26}
27
29{
30 delete[] reinterpret_cast<unsigned char *>(page.GetBuffer());
31}
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
RPage NewPage(std::size_t elementSize, std::size_t nElements) final
Reserves memory large enough to hold nElements of the given size.
void DeletePage(RPage &page) final
Releases the memory pointed to by page and resets the page's information.
A page is a slice of a column that is mapped into memory.
Definition RPage.hxx:43
void * GetBuffer() const
Definition RPage.hxx:142