Title: Memory leak possible if transaction closed before cursor. · Issue #197 · lmdbjava/lmdbjava · GitHub
Open Graph Title: Memory leak possible if transaction closed before cursor. · Issue #197 · lmdbjava/lmdbjava
X Title: Memory leak possible if transaction closed before cursor. · Issue #197 · lmdbjava/lmdbjava
Description: lmdb closes and free()'s the memory used by MDB_cursor objects if they are created with a write transaction while cursors created with a read transaction must be manually closed/freed via mdb_cursor_close() So far, so good. lmdbjava's Db...
Open Graph Description: lmdb closes and free()'s the memory used by MDB_cursor objects if they are created with a write transaction while cursors created with a read transaction must be manually closed/freed via mdb_curso...
X Description: lmdb closes and free()'s the memory used by MDB_cursor objects if they are created with a write transaction while cursors created with a read transaction must be manually closed/freed via mdb_c...
Opengraph URL: https://github.com/lmdbjava/lmdbjava/issues/197
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Memory leak possible if transaction closed before cursor.","articleBody":"lmdb closes and `free()`'s the memory used by `MDB_cursor` objects if they are created with a write transaction while cursors created with a read transaction must be manually closed/freed via `mdb_cursor_close()`\r\n\r\nSo far, so good. lmdbjava's `Dbi.openCursor()` includes documentation to this effect \r\n```\r\n ...A cursor in a write-transaction can\r\n * be closed before its transaction ends, and will otherwise be closed when\r\n * its transaction ends. A cursor in a read-only transaction must be closed\r\n * explicitly, before or after its transaction ends...\r\n```\r\n\r\nlmdbjava's `Cursor.close()` even includes a helpful check to prevent clients from accidentally double `free()`ing the native cursor object by ensuring that the method throws an error if the cursor was opened with a write transaction that is now closed. Very nice.\r\n\r\nNow for the problem: lmdbjava's `Cursor` owns *two* native resources, the `MDB_cursor` object *and* the KeyVal object which allocates memory for `MDB_val`s. KeyVal's native memory cannot be disposed of by the client if the transaction was writeable and closed first.\r\n\r\nSuggest updating close to independently dispose of both native resources so that the (useful) double free protection doesn't leak the KeyVal","author":{"url":"https://github.com/danielcranford","@type":"Person","name":"danielcranford"},"datePublished":"2022-07-05T16:02:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/197/lmdbjava/issues/197"}
| 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:99a27fcf-fc2e-1d43-24c0-93f0f28a6305 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D18C:203DA6:EAF04D:13A5B80:69705140 |
| html-safe-nonce | 63fa987f5e5d8067909ffc7825568293172786e7d3f7f9270365457c00c12c2c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMThDOjIwM0RBNjpFQUYwNEQ6MTNBNUI4MDo2OTcwNTE0MCIsInZpc2l0b3JfaWQiOiIzMDI4NzA4NzY1OTMxMTYzOTY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8e7161633febb9c7ae4b1c6384eddd17f10e5b012f6660a76d09668e68da96e4 |
| hovercard-subject-tag | issue:1294491487 |
| 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/lmdbjava/lmdbjava/197/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5fc9082869e72ecffbeebc0266b064b89f8287d8fb54387f1e5709dc8433ba45/lmdbjava/lmdbjava/issues/197 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5fc9082869e72ecffbeebc0266b064b89f8287d8fb54387f1e5709dc8433ba45/lmdbjava/lmdbjava/issues/197 |
| og:image:alt | lmdb closes and free()'s the memory used by MDB_cursor objects if they are created with a write transaction while cursors created with a read transaction must be manually closed/freed via mdb_curso... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | danielcranford |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/lmdbjava/lmdbjava git https://github.com/lmdbjava/lmdbjava.git |
| octolytics-dimension-user_id | 19765602 |
| octolytics-dimension-user_login | lmdbjava |
| octolytics-dimension-repository_id | 60480511 |
| octolytics-dimension-repository_nwo | lmdbjava/lmdbjava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 60480511 |
| octolytics-dimension-repository_network_root_nwo | lmdbjava/lmdbjava |
| 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 | f643964067a552f02067066d6a910b2f90a5721f |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width