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

Fix xMalloc usage #1931

Merged
merged 1 commit into from
Nov 5, 2018
Merged

Fix xMalloc usage #1931

merged 1 commit into from
Nov 5, 2018

Conversation

edigaryev
Copy link
Contributor

No need to allocate sizeof(CXXToken) * sizeof(CXXToken) bytes for a single token structure when 1 * sizeof(CXXToken) bytes is enough.

This fixes ctags memory usage issue mentioned here: oracle/opengrok#2364

@coveralls
Copy link

coveralls commented Nov 4, 2018

Coverage Status

Coverage remained the same at 84.893% when pulling 6952bef on edigaryev:correct-xmalloc-usage into ed9b58d on universal-ctags:master.

No need to allocate sizeof(CXXToken) * sizeof(CXXToken) bytes
for a single token structure when 1 * sizeof(CXXToken) bytes is enough.

Same applies to CXXTokenChain.

(also see oracle/opengrok#2364)
@b4n b4n requested a review from pragmaware November 5, 2018 09:01
Copy link
Member

@b4n b4n left a comment

Choose a reason for hiding this comment

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

LGTM, good catch.

@masatake
Copy link
Member

masatake commented Nov 5, 2018

LGTM.

@masatake masatake merged commit 0f27679 into universal-ctags:master Nov 5, 2018
@edigaryev edigaryev deleted the correct-xmalloc-usage branch November 5, 2018 12:52
@pragmaware
Copy link
Contributor

Yep, good catch indeed.

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.

5 participants