Author: jolee
Date: 2013-02-05 15:09:09 -0500 (Tue, 05 Feb 2013)
New Revision: 4550
Added:
branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/impl/TestBlockByteBuffer.java
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BlockByteBuffer.java
Log:
TEIID-2360: Memory buffer sizes over 1GB are not correctly handled
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BlockByteBuffer.java
===================================================================
---
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BlockByteBuffer.java 2013-02-05
19:59:24 UTC (rev 4549)
+++
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BlockByteBuffer.java 2013-02-05
20:09:09 UTC (rev 4550)
@@ -73,7 +73,7 @@
}
buffers = new ThreadLocal[segments];
for (int i = 0; i < fullSegments; i++) {
- buffers[i] = new ThreadLocalByteBuffer(allocate(lastSegmentSize, direct));
+ buffers[i] = new ThreadLocalByteBuffer(allocate(segmentSize, direct));
}
if (lastSegmentSize > 0) {
buffers[fullSegments] = new ThreadLocalByteBuffer(allocate(lastSegmentSize, direct));
Added:
branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/impl/TestBlockByteBuffer.java
===================================================================
---
branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/impl/TestBlockByteBuffer.java
(rev 0)
+++
branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/impl/TestBlockByteBuffer.java 2013-02-05
20:09:09 UTC (rev 4550)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.common.buffer.impl;
+
+import org.junit.Test;
+
+public class TestBlockByteBuffer {
+
+ @Test public void testBufferSizing() {
+ BlockByteBuffer bbb = new BlockByteBuffer(4, 100, 4, false);
+ bbb.getByteBuffer(1);
+ }
+
+}