carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From landreamer <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #450: [CARBONDATA-545]Added support for of...
Date Tue, 27 Dec 2016 17:06:49 GMT
Github user landreamer commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/450#discussion_r93948200
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/carbon/datastore/chunk/store/impl/ByteMeasureChunkStore.java
---
    @@ -0,0 +1,56 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.carbondata.core.carbon.datastore.chunk.store.impl;
    +
    +import org.apache.carbondata.core.memory.MemoryAllocatorFactory;
    +import org.apache.carbondata.core.unsafe.CarbonUnsafe;
    +
    +/**
    + * Responsible for storing Byte array data to memory.
    + * memory can be on heap or offheap based on the user configuration
    + */
    +public class ByteMeasureChunkStore extends AbstractMeasureDataChunkStore<byte[]>
{
    +
    +  public ByteMeasureChunkStore(int numberOfRows) {
    +    super(numberOfRows);
    +  }
    +
    +  /**
    +   * Below method will be used to put byte array data to memory
    +   *
    +   * @param data
    +   */
    +  @Override public void putData(byte[] data) {
    +    this.dataPageMemoryBlock =
    +        MemoryAllocatorFactory.INSATANCE.getMemoryAllocator().allocate(data.length);
    --- End diff --
    
    As the isMemoryReleased is false after construct the class, if then call freeMemory before
calling putData, the object will free a null object. Or if putData is called twice continuously,
the older dataPageMemoryBlock will not be referenced and the memory it holds will leak. It
seems this class must be careful use to avoid memory problem on off-heap. It not has a strong
status check to make program robust.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message