Repository navigation
Commit 7ad32dd
fix(jni): release the schema export in VortexWriter.build() (#18)
## Summary
`VortexWriter.build()` exports an Arrow schema that native creation
borrows. Closing only the schema struct leaks the child allocations.
Release the export before closing the struct, for both URI and stream
writers.
The cleanup uses separate try-with-resources entries: the release
callback runs before the struct closes, both cleanup steps are
attempted, and cleanup failures are suppressed onto an existing export
or creation failure. The release callback is checked before invocation
so an export that did not install one can still be cleaned up.
## Review follow-up
- Parameterize the allocation regression across URI/stream writers,
flat/nested schemas, and successful/rejected creation (eight cases).
- Check that native metadata validation errors retain their cause and
leave no Arrow allocations.
- Use a child of the shared root allocator for isolated leak assertions.
- Keep native schema borrowing unchanged. The separate address-based
batch-schema leak from the review is tracked in #53.
## Validation
The original revision was checked with `./gradlew --parallel --continue
javadoc check`. The latest cleanup and test changes have not been run;
build, test, lint, and formatting execution remain the user's choice
under repository guidance.
I used AI tools to help write and review this change.
---------
Signed-off-by: gitRasheed <[email protected]>
Signed-off-by: Christopher Wirt <[email protected]>
Co-authored-by: Christopher Wirt <[email protected]>1 parent 85d8c8a commit 7ad32dd
2 files changed
Lines changed: 65 additions & 4 deletions
File tree
- java/vortex-jni/src
- main/java/dev/vortex/api
- test/java/dev/vortex/jni
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
149 | | - | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
151 | 158 | | |
152 | 159 | | |
153 | 160 | | |
| |||
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
167 | | - | |
168 | | - | |
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
| 55 | + | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
| |||
169 | 173 | | |
170 | 174 | | |
171 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
172 | 228 | | |
173 | 229 | | |
174 | 230 | | |
| |||
0 commit comments