If you create a Java client, producer, consumer, or reader, you can use the loadConf configurations.
You can set the client memory allocator configurations through Java properties.
| Property | Type | Description | Default | Available values |
|---|---|---|---|---|
pulsar.allocator.pooled | String | If set to true, the client uses a direct memory pool. If set to false, the client uses a heap memory without pool. | true | true false |
pulsar.allocator.exit_on_oom | String | Whether to exit the JVM when OOM happens. | false | true false |
pulsar.allocator.leak_detection | String | The leak detection policy for Pulsar bytebuf allocator. Disabled: No leak detection and no overhead. Simple: Instruments 1% of the allocated buffer to track for leaks. Advanced: Instruments 1% of the allocated buffer to track for leaks, reporting stack traces of places where the buffer is used. Paranoid: Instruments 100% of the allocated buffer to track for leaks, reporting stack traces of places where the buffer is used and introduces a significant overhead. | Disabled | Disabled Simple Advanced Paranoid |
pulsar.allocator.out_of_memory_policy | String | When an OOM occurs, the client throws an exception or fallbacks to heap. | FallbackToHeap | ThrowException FallbackToHeap |
Example
Dpulsar.allocator.pooled=true Dpulsar.allocator.exit_on_oom=false Dpulsar.allocator.leak_detection=Disabled Dpulsar.allocator.out_of_memory_policy=ThrowException