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

radiff2: support comparing files larger than available memory #2338

Open
davispuh opened this issue Apr 9, 2015 · 8 comments
Open

radiff2: support comparing files larger than available memory #2338

davispuh opened this issue Apr 9, 2015 · 8 comments

Comments

@davispuh
Copy link
Contributor

davispuh commented Apr 9, 2015

Currently when you attempt to compare files larger than available memory you'll get a very helpful error message

$ radiff2 bigfile1 bigfile2
radiff2: Cannot open (null)

It happens because r_file_slurp at radiff2.c#286 tries to allocate memory for whole file which fails and so it returns NULL

@radare
Copy link
Collaborator

radare commented Apr 9, 2015

how big are those files?

On 04/09/2015 02:01 AM, Dāvis wrote:

Currently when you attempt to compare files larger than available memory you'll get a very helpful error message

$ radiff2 bigfile1 bigfile2
radiff2: Cannot open (null)

It happens because r_file_slurp at radiff2.c#286 tries to allocate memory for whole file which fails and so it returns NULL


Reply to this email directly or view it on GitHub:
#2338

@davispuh
Copy link
Contributor Author

davispuh commented Apr 9, 2015

~8 GiB for each file, but I've just 8 GiB RAM and 1 GiB swap, now I increased swap and seems it's working, no error yet.
I would also suggest to improve that error as without looking at code it's not possible to tell what's wrong :P

@jvoisin
Copy link
Contributor

jvoisin commented Apr 9, 2015

Fix it with hardware :)

@davispuh
Copy link
Contributor Author

davispuh commented Apr 9, 2015

this time yeah, but what about comparing 10 TiB files?

@jvoisin
Copy link
Contributor

jvoisin commented Apr 9, 2015

Ask this guy.

More seriously, I diffing file in anything else than non-trivial way will require a lot of thinking :)

@radare
Copy link
Collaborator

radare commented Apr 9, 2015

Plain byte diffing should not allocate the whole bin in memory. This can be fixed with a loop. But i didnt looked how its done now.

On 09 Apr 2015, at 15:32, jvoisin notifications@github.com wrote:

Fix it with hardware :)


Reply to this email directly or view it on GitHub.

@radare
Copy link
Collaborator

radare commented Apr 9, 2015

Iirc this was alreay done in r2 cmp command, so it should be a 5min fix, if no one does it for me i will take care of this when i have some time

On 09 Apr 2015, at 18:18, jvoisin notifications@github.com wrote:

Ask this guy.

More seriously, I diffing file in anything else than non-trivial way will require a lot of thinking :)


Reply to this email directly or view it on GitHub.

@Maijin Maijin added the radiff2 label Mar 10, 2017
@igittigitthub
Copy link

I wanted to compare two files of 46G but my system only has 32G memory.

My output:

radiff2: Cannot open FILENAME

My version:

radiff2 2.3.0 0 @ linux-x86-64 git.2.3.0
commit: HEAD build: 2018-02-23__17:22:33

A more detailed output would be nice. Maybe something like "Not enough memory" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants