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

performOnDataInArchive needs too much RAM #100

Open
polaronde opened this issue Sep 22, 2021 · 0 comments
Open

performOnDataInArchive needs too much RAM #100

polaronde opened this issue Sep 22, 2021 · 0 comments

Comments

@polaronde
Copy link

Within the while loop in performOnDataInArchive, a buffer is allocated with malloc and used for an NSData object:

NSData *data = [NSData dataWithBytesNoCopy:buffer length:(NSUInteger)info.uncompressedSize freeWhenDone:YES];

The intention is that the memory is freed when the NSData object is released. But this happens only later, outside of the while loop. So when processing a large RAR archive, this while loop eats up the RAM.

Suggestion: Use realloc instead of malloc, do not give the NSData object ownership of the memory, and call free(buffer) when the loop is done.

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

No branches or pull requests

1 participant