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

get rid of unnecessary mut #28017

Merged
merged 1 commit into from
Sep 26, 2022
Merged

Conversation

jeffwashington
Copy link
Contributor

@jeffwashington jeffwashington commented Sep 23, 2022

Problem

1.14 is having oom issues
hash calc can perform its operations on files instead of using ram spikes
Some refactoring needs to occur for this.

Summary of Changes

Make non-mut version of access to loaded hash cache data.
This will be used later to remove the current requirement of having a &mut self

Fixes #

Copy link
Contributor

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

Lgtm. The one nit; no need for re-review on changes (or if my nit doesn't work since I didn't try it out myself).

fn get<T: Sized>(&self, ix: u64) -> &T {
let item_slice = self.get_slice_internal::<T>(ix);
unsafe {
let item = item_slice.as_ptr() as *const T;
Copy link
Contributor

@brooksprumo brooksprumo Sep 26, 2022

Choose a reason for hiding this comment

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

nit: Can this let line be moved out of the unsafe block? Iiuc, only the deref needs to be scoped by unsafe.

Same for the get_mut fn as well.

@jeffwashington jeffwashington merged commit de7a5f2 into solana-labs:master Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants