Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -99,6 +99,7 @@ protected BaseAllocator(

}

@Override
public void assertOpen() {
if (AssertionUtil.ASSERT_ENABLED) {
if (isClosed) {
Expand DownExpand Up@@ -287,6 +288,7 @@ public Reservation() {
}
}

@Override
public boolean add(final int nBytes) {
assertOpen();

Expand All@@ -308,6 +310,7 @@ public boolean add(final int nBytes) {
return true;
}

@Override
public ArrowBuf allocateBuffer() {
assertOpen();

Expand All@@ -319,14 +322,17 @@ public ArrowBuf allocateBuffer() {
return arrowBuf;
}

@Override
public int getSize() {
return nBytes;
}

@Override
public boolean isUsed() {
return used;
}

@Override
public boolean isClosed() {
return closed;
}
Expand DownExpand Up@@ -364,6 +370,7 @@ public void close() {
closed = true;
}

@Override
public boolean reserve(int nBytes) {
assertOpen();

Expand DownExpand Up@@ -509,6 +516,7 @@ public synchronized void close() {

}

@Override
public String toString() {
final Verbosity verbosity = logger.isTraceEnabled() ? Verbosity.LOG_WITH_STACKTRACE
: Verbosity.BASIC;
Expand All@@ -523,6 +531,7 @@ public String toString() {
*
* @return A Verbose string of current allocator state.
*/
@Override
public String toVerboseString() {
final StringBuilder sb = new StringBuilder();
print(sb, 0, Verbosity.LOG_WITH_STACKTRACE);
Expand DownExpand Up@@ -575,13 +584,12 @@ void verifyAllocator() {
* when any problems are found
*/
private void verifyAllocator(final IdentityHashMap<UnsafeDirectLittleEndian, BaseAllocator> buffersSeen) {
synchronized (DEBUG_LOCK) {

// The remaining tests can only be performed if we're in debug mode.
if (!DEBUG) {
return;
}
// The remaining tests can only be performed if we're in debug mode.
if (!DEBUG) {
return;
}

synchronized (DEBUG_LOCK) {
final long allocated = getAllocatedMemory();

// verify my direct descendants
Expand Down