Title: Data import methods free memory · Issue #763 · apache/arrow-java · GitHub
Open Graph Title: Data import methods free memory · Issue #763 · apache/arrow-java
X Title: Data import methods free memory · Issue #763 · apache/arrow-java
Description: The various import methods in the Data class are documented to transfer ownership of the Arrow data from the input object to internal values as per the C FFI. If I'm reading https://arrow.apache.org/docs/format/CDataInterface.html#moving...
Open Graph Description: The various import methods in the Data class are documented to transfer ownership of the Arrow data from the input object to internal values as per the C FFI. If I'm reading https://arrow.apache.or...
X Description: The various import methods in the Data class are documented to transfer ownership of the Arrow data from the input object to internal values as per the C FFI. If I'm reading https://arrow.apach...
Opengraph URL: https://github.com/apache/arrow-java/issues/763
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Data import methods free memory","articleBody":"The various import methods in the Data class are documented to transfer ownership of the Arrow data from the input object to internal values as per the C FFI. If I'm reading https://arrow.apache.org/docs/format/CDataInterface.html#moving-an-array correctly, implementations are supposed to hollow out the input object in that case by nulling the release field. In practice a class like ArrayImporter does this\n\n```\nvoid importArray(ArrowArray src) {\n ...\n // Move imported array\n ArrowArray ownedArray = ArrowArray.allocateNew(allocator);\n ownedArray.save(snapshot);\n src.markReleased();\n src.close();\n ...\n}\n```\n\nSo not only is the array marked as released, it is also closed so the ArrowArray instance is no longer usable. This may or may not happen when you call `Data#importIntoVector` for instance, since that might abort early when given a null `Allocator` which makes the post conditions of `Data#importIntoVector` a bit unclear. You kind of expect the ArrowArray to have been closed, but you still need to call close yourself as well or risk having a memory leak.\n\nWhat's the rationale behind the choice to also call `close` on objects passed to Data rather than expecting people to use try-with-resources/try-finally themselves?","author":{"url":"https://github.com/pepijnve","@type":"Person","name":"pepijnve"},"datePublished":"2025-05-22T09:29:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/763/arrow-java/issues/763"}
| 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:170a15c7-07e6-8456-0bbd-c47539f3c876 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9780:6F3CF:6960A63:936CB7E:6A504DC8 |
| html-safe-nonce | 5fe1b5e4234bb8d65c57545b4823e7964a2f29bdcfcc2e8cf1d9b24621c7a214 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzgwOjZGM0NGOjY5NjBBNjM6OTM2Q0I3RTo2QTUwNERDOCIsInZpc2l0b3JfaWQiOiIyMDMxNTQ3MzgxMzU5NTk0OTUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e2c46fca27e6253d4c5e27d4f4e57dbd6ef5ddd6839c12b6700eab26ba7117ea |
| hovercard-subject-tag | issue:3082696463 |
| 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/763/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6426a7bc6509bc8663489ea49da24fced584cc4918a9e638afc74a318bb591d9/apache/arrow-java/issues/763 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6426a7bc6509bc8663489ea49da24fced584cc4918a9e638afc74a318bb591d9/apache/arrow-java/issues/763 |
| og:image:alt | The various import methods in the Data class are documented to transfer ownership of the Arrow data from the input object to internal values as per the C FFI. If I'm reading https://arrow.apache.or... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pepijnve |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| 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 | 5741a45fe07e5f377d0d4c524a92e3056acc51bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width