wangfenjin commented on pull request #1334: URL: https://github.com/apache/arrow-rs/pull/1334#issuecomment-1064828113
Guys, not sure if my understanding is right, but I think this commit will break the design and create memory leak. If we clone the FFI struct, then it means we need to free the pointer by ourself, but if we free FFI_ArrowArray, then the data in this Array will also be free? Which means we can't free the pointer(until the data are used and ready to free, but in reality we can't hold this useless pointer in a big project for such a long time), which create memory leak. As to the question @viirya raised in #1333 , when manage memory, the one who allocate it should free it, which means in our case, we need to alloc the struct in rust and pass the pointer to java and then also free the memory in rust. * You can check my code in here: https://github.com/wangfenjin/duckdb-rs/blob/5083d39a4147f8017613304ae5f217a88ac42c2e/src/raw_statement.rs#L58 * When I try to upgrade to version 10, [memory leak detected](https://github.com/wangfenjin/duckdb-rs/runs/5506654342?check_suite_focus=true) and there is no easy way to fix it. I suggest we revert this commit. cc @alamb @sunchao -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
