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

atoi on AIX translates to 32bit integer value (when specifying memory size in bytes) #10

Open
jose1711 opened this issue Feb 8, 2021 · 0 comments

Comments

@jose1711
Copy link
Contributor

jose1711 commented Feb 8, 2021

https://github.com/julman99/eatmemory/blob/master/eatmemory.c#L85

Even if compiled with -maix64 size always contains 32bit integer which means one cannot allocate more than 2147483647 bytes. Replacing with atol solves the issue.

With atoi (original):

$ ./eatmemory 3000000000000000
Currently total memory: -4096
Currently avail memory: -4096
Eating 2147483647 bytes in chunks of 1024...

With atol (new):

$ eatmemory 3000000000000000
Currently total memory: -4096
Currently avail memory: -4096
Eating 3000000000000000 bytes in chunks of 1024...
jose1711 added a commit to jose1711/eatmemory that referenced this issue Feb 9, 2021
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