Title: [Java] Allocator `buffer` method no setting the capacity correctly. · Issue #141 · apache/arrow-java · GitHub
Open Graph Title: [Java] Allocator `buffer` method no setting the capacity correctly. · Issue #141 · apache/arrow-java
X Title: [Java] Allocator `buffer` method no setting the capacity correctly. · Issue #141 · apache/arrow-java
Description: Describe the bug, including details regarding any error messages, version, and platform. The following snippet package org.apache.arrow.vector; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.RootAllocator; import...
Open Graph Description: Describe the bug, including details regarding any error messages, version, and platform. The following snippet package org.apache.arrow.vector; import org.apache.arrow.memory.ArrowBuf; import org.a...
X Description: Describe the bug, including details regarding any error messages, version, and platform. The following snippet package org.apache.arrow.vector; import org.apache.arrow.memory.ArrowBuf; import org.a...
Opengraph URL: https://github.com/apache/arrow-java/issues/141
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Java] Allocator `buffer` method no setting the capacity correctly.","articleBody":"### Describe the bug, including details regarding any error messages, version, and platform.\n\nThe following snippet\r\n```java\r\npackage org.apache.arrow.vector;\r\n\r\nimport org.apache.arrow.memory.ArrowBuf;\r\nimport org.apache.arrow.memory.RootAllocator;\r\nimport org.junit.jupiter.api.Test;\r\n\r\n\r\npublic class BufferAllocatorOverAllocation {\r\n\r\n @Test\r\n void overallocation() {\r\n RootAllocator allocator = new RootAllocator();\r\n ArrowBuf buf = allocator.buffer(9946);\r\n\r\n System.out.println(buf.capacity());\r\n\r\n buf.capacity(9946);\r\n\r\n System.out.println(buf.capacity());\r\n\r\n }\r\n\r\n}\r\n```\r\nprints\r\n```\r\n16384\r\n9946\r\n```\r\nSo without setting the capacity explicitly the allocator overallocates memory and also seems to set the capacity of the buffer to that. That is contrary to the docstring of the `buffer` method:\r\n```\r\nNote that the buffer may technically be larger than the requested size for rounding purposes. However, the buffer's capacity will be set to the configured size.\r\n```\r\n\r\nTested against the `14.0.2` tag. \r\n\n\n### Component(s)\n\nJava","author":{"url":"https://github.com/FiV0","@type":"Person","name":"FiV0"},"datePublished":"2024-01-11T08:41:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/141/arrow-java/issues/141"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d44f83b9-d514-a16d-5ea7-22b853ad3828 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D45E:AF773:209643B:2CC38A5:6A4EC4D7 |
| html-safe-nonce | 3c904afef3faccb414e0365a9fb6c2d0054fb9150044548ec23fdf6ba237cf4e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDVFOkFGNzczOjIwOTY0M0I6MkNDMzhBNTo2QTRFQzRENyIsInZpc2l0b3JfaWQiOiIzNjQ2MDAyOTA2MjAzNjA0MTg0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a8013bd2161f2e61549cf2a3a8b71db0663d561b8334d48bbe76bef8dedc4066 |
| hovercard-subject-tag | issue:2695809452 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/arrow-java/141/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ef18d999aa7aeb0f1f892feaf936c658d601af1022604388270bddb47a914d1e/apache/arrow-java/issues/141 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ef18d999aa7aeb0f1f892feaf936c658d601af1022604388270bddb47a914d1e/apache/arrow-java/issues/141 |
| og:image:alt | Describe the bug, including details regarding any error messages, version, and platform. The following snippet package org.apache.arrow.vector; import org.apache.arrow.memory.ArrowBuf; import org.a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | FiV0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| go-import | github.com/apache/arrow-java git https://github.com/apache/arrow-java.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 893682219 |
| octolytics-dimension-repository_nwo | apache/arrow-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 893682219 |
| octolytics-dimension-repository_network_root_nwo | apache/arrow-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width