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

[SPARK-26662][CORE] Dispose off-heap memory when MemoryStore is cleared #23585

Closed
wants to merge 1 commit into from

Conversation

SongYadong
Copy link
Contributor

What changes were proposed in this pull request?

If buffer in MemoryStore's SerializedMemoryEntry is allocated off-heap, current clear() action doesn't dispose them. These off-heap memory, though, will be freed when process ends, but for application that need to stop and restart SparkContext serveral times, this may cause some kind of off-heap memory leak.
This PR try to dispose off-heap memory by itself when clearing MemoryStore.

How was this patch tested?

Tested manually by running code written myself, while observing system resources monitor to verify off-heap memory allocation and free behavior.
I have tried to add a unit test, but it's hard to find a way counting off-heap memory allocated by Unsafe API.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@srowen
Copy link
Member

srowen commented Jan 18, 2019

I don't know this code well, but it looks reasonable to me. I suppose the only drawback is the extra work to dispose these upfront? but seems like good hygiene.

@SongYadong
Copy link
Contributor Author

Yeah, in my new test, this may cost extra time that can not be ignored. I'll close this PR. Thanks for review. @srowen

@SongYadong SongYadong closed this Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants