-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(alloc): policies of memory allocator (#957)
Signed-off-by: Ning Yu <[email protected]>
- Loading branch information
1 parent
c332510
commit 7dcdb78
Showing
5 changed files
with
89 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
s3stream/src/main/java/com/automq/stream/s3/ByteBufAllocPolicy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2024, AutoMQ CO.,LTD. | ||
* | ||
* Use of this software is governed by the Business Source License | ||
* included in the file BSL.md | ||
* | ||
* As of the Change Date specified in that file, in accordance with | ||
* the Business Source License, use of this software will be governed | ||
* by the Apache License, Version 2.0 | ||
*/ | ||
|
||
package com.automq.stream.s3; | ||
|
||
public enum ByteBufAllocPolicy { | ||
|
||
/** | ||
* Allocate memory from the heap without pooling. | ||
*/ | ||
UNPOOLED_HEAP(false, false), | ||
|
||
/** | ||
* Use pooled direct memory. | ||
*/ | ||
POOLED_DIRECT(true, true); | ||
|
||
/** | ||
* Whether the buffer should be pooled or not. | ||
*/ | ||
private final boolean pooled; | ||
|
||
/** | ||
* Whether the buffer should be direct or not. | ||
*/ | ||
private final boolean direct; | ||
|
||
ByteBufAllocPolicy(boolean pooled, boolean direct) { | ||
this.pooled = pooled; | ||
this.direct = direct; | ||
} | ||
|
||
public boolean isPooled() { | ||
return pooled; | ||
} | ||
|
||
public boolean isDirect() { | ||
return direct; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters