Skip to content

Fix malloc_bench calloc logic #20648

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

Merged
merged 2 commits into from
Nov 8, 2023
Merged

Fix malloc_bench calloc logic #20648

merged 2 commits into from
Nov 8, 2023

Conversation

kripken
Copy link
Member

@kripken kripken commented Nov 7, 2023

The condition was flipped, that is, if calloc mode was disabled we actually ran
calloc.

@kripken kripken requested a review from sbc100 November 7, 2023 23:16
@@ -85,7 +85,7 @@ void randoms() {
total_allocated += size;
}
} else {
if (calloc_ && USE_CALLOC) {
if (!calloc_ || !USE_CALLOC) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Keep the condition expressed in positives and flip the bodies instead?

What is calloc_ (with the trailing underscore)? When would USE_CALLOC befined but not calloc_

Copy link
Member Author

Choose a reason for hiding this comment

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

The benchmark has a global setting USE_CALLOC, and a random decision in each iteration as well. So it is checking if we allow calloc both globally and locally.

I'll reverse the condition.

@kripken kripken merged commit 404a8e9 into main Nov 8, 2023
@kripken kripken deleted the malloc.bench.calloc branch November 8, 2023 01:03
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