Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBL-5794: FLSliceResult leaks memory #297

Merged
merged 2 commits into from
Jun 7, 2024
Merged

Conversation

bmeike
Copy link
Contributor

@bmeike bmeike commented Jun 6, 2024

FLSliceResult is not freeing the block of memory it frames. This is an enormous memory leak.

This is a minimal backport of #296: the SliceResult is freed by the finalizer; not explicitly.

Also removed an unused file logger function

@bmeike bmeike requested review from pasin and borrrden June 6, 2024 22:17
@bmeike bmeike self-assigned this Jun 6, 2024
// NOTE: We expect the FLSliceResult returned by this method to be handed, immediately,
// to someone else (LiteCore) who will release it. Java does release the memory.
@NonNull
public FLSliceResult finish3() throws LiteCoreException { return impl.nFinish3(getPeer()); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to think about a better name than 1, 2, 3 but it's hard to come up with a good one. Maybe finishAndGetManagedFLSliceResult (how long is this?).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I absolutely agree. I am going to rename them. I just didn't want to make this commit even bigger than it already is. I think "EncodedToByteArray", "EncodeToSliceResult", and EncodeToUnmanagedSliceResult".

@bmeike bmeike merged commit 928f57c into android/release/3.2 Jun 7, 2024
@bmeike bmeike deleted the pr/CBL-5794 branch June 7, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants