apache / apache/arrow-java

[Java] Netty memory release

未关闭
#215 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Type: bug
主要语言
Java
星标
94
派生
152
平均合并
3 天 16 小时
30 天内合并 PR
11

描述

### Describe the bug, including details regarding any error messages, version, and platform.

Since when we use netty as my memory allocator manager, I found that direct memory is not released after vector is closed.
```
Field field = new Field("test", FieldType.nullable(new ArrowType.Utf8()), null);
RootAllocator allocator = new RootAllocator(Long.MAX_VALUE);
FieldVector vector = field.createVector(allocator);
for (int i = 0; i < 100000; i++){
((VarCharVector)vector).setSafe(i, "test".getBytes(StandardCharsets.UTF_8));
}

System.out.println("before close memory: " + usedDirectMemory() + " bytes"); //before close memory: 4194304 bytes
vector.close();
allocator.close();
System.out.println("after closed memory: " + usedDirectMemory() + " bytes"); //after closed memory: 4194304 bytes
```
I can address the problem that if the inner allocator `PooledByteBufAllocator` won't free the memory chunk , I am not sure if this is expected.

### Component(s)

Java

贡献指南

打开贡献指南

调研方向

从使用 RootAllocator、VarCharVector 和 PooledByteBufAllocator 的 Java 复现开始,然后跟踪 allocator 的关闭行为以及 Netty 对直接内存的处理。确认剩余的 4194304 字节究竟是实际的泄漏,还是预期的池化行为,并记录或测试由此得到的预期行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
performance
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。