Return-Path: X-Original-To: apmail-directmemory-dev-archive@www.apache.org Delivered-To: apmail-directmemory-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 24FD9DF91 for ; Thu, 1 Nov 2012 13:55:16 +0000 (UTC) Received: (qmail 55317 invoked by uid 500); 1 Nov 2012 13:55:15 -0000 Delivered-To: apmail-directmemory-dev-archive@directmemory.apache.org Received: (qmail 55161 invoked by uid 500); 1 Nov 2012 13:55:14 -0000 Mailing-List: contact dev-help@directmemory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directmemory.apache.org Delivered-To: mailing list dev@directmemory.apache.org Received: (qmail 54839 invoked by uid 500); 1 Nov 2012 13:55:12 -0000 Delivered-To: apmail-incubator-directmemory-dev@incubator.apache.org Received: (qmail 54827 invoked by uid 99); 1 Nov 2012 13:55:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Nov 2012 13:55:12 +0000 Date: Thu, 1 Nov 2012 13:55:12 +0000 (UTC) From: "Hudson (JIRA)" To: directmemory-dev@incubator.apache.org Message-ID: <68830200.55951.1351778112757.JavaMail.jiratomcat@arcas> In-Reply-To: <497192575.53841.1325249130697.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (DIRECTMEMORY-49) MemoryManagerService.update does not reuse the same pointer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DIRECTMEMORY-49?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488701#comment-13488701 ] Hudson commented on DIRECTMEMORY-49: ------------------------------------ Integrated in directmemory-trunk #351 (See [https://builds.apache.org/job/directmemory-trunk/351/]) DIRECTMEMORY-49 MemoryManagerService.update does not reuse the same pointer (Revision 1404554) Result = UNSTABLE noctarius : Files : * /directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/AbstractMemoryManager.java > MemoryManagerService.update does not reuse the same pointer > ----------------------------------------------------------- > > Key: DIRECTMEMORY-49 > URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-49 > Project: Apache DirectMemory > Issue Type: Bug > Reporter: Benoit Perroud > Assignee: Christoph Engelbert > Priority: Minor > Fix For: 0.2 > > > MemoryManagerService.update actually free and store again the payload, which leads to another pointer allocation. This is fine in lots of case, but when the buffer is full, we still want the update to succeed. > Moreover, update should throw an exception (BufferOverFlowException for example) when the new payload data is bigger than the previous. > Considering the following test, where I allocate just enough space for 1 object, I store it, and then want to update it content. I could hope this use case succeed, but it's actually not the case > {code} > @Test > public void testOffHeapMemoryBufferUpdate() { > > final int NUMBER_OF_OBJECTS = 1; > final int BUFFER_SIZE = NUMBER_OF_OBJECTS * 4; // allocate 4 bytes > > final OffHeapMemoryBuffer offHeapMemoryBuffer = OffHeapMemoryBufferImpl.createNew(BUFFER_SIZE); > // generate 4 random bytes, store, read back and assert > final byte[] payload = generateRandomPayload(4); > final Pointer pointer = offHeapMemoryBuffer.store(payload); > Assert.assertNotNull(pointer); > Assert.assertEquals(new String(payload), new String(offHeapMemoryBuffer.retrieve(pointer))); > > // generate another payload, update it, read it and assert. > byte[] otherPayload = generateRandomPayload(4); > final Pointer otherPointer = offHeapMemoryBuffer.update(pointer, otherPayload); > Assert.assertNotNull(otherPointer); > Assert.assertEquals(new String(otherPayload), new String(offHeapMemoryBuffer.retrieve(otherPointer))); > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira