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

On MAX_LONG #419

Open
LHe496 opened this issue Nov 16, 2024 · 1 comment
Open

On MAX_LONG #419

LHe496 opened this issue Nov 16, 2024 · 1 comment

Comments

@LHe496
Copy link
Contributor

LHe496 commented Nov 16, 2024

The MAX_LONG is defined as 2147483647, which is the biggest integer a 4-byte int type.
However, on 64-bit POSIX systems, the type long is 8-byte int whose largest number is 9223372036854775807.
Do we need to set a different upper limit for 64-bit systems since XLONG is defined as long on these devices?
This limits the RAM limit on 64-bit systems to 2047MiB, which is MAX_LONG bytes.

The long int on Windows is 4-byte both on 32-bit and 64-bit, BTW.

Besides, the IRAF kernel uses RLIMIT_RSS to detect the limit of available RAM. But as the man page said on Linux, it "has effect only in Linux 2.4.x, x < 30, and there affects only calls to madvise(2) specifying MADV_WILLNEED." Do we need to use RLIMIT_AS instead?

@olebole
Copy link
Member

olebole commented Nov 17, 2024

In principle you are right here; however keep in mind the IRAF is legacy software, and I would in any case not recommend to create new use cases with >4GB memory requirements. Specifically is 64-bit IRAF not the "usual" LP64 (i.e. 32 bit int, 64 bit long) architecture on SPP/Fortran side, but ILP64 (both int and long are 64 bit); so MAX_INT would be affected as well. And there are no tests that would cover a significant portion of the source code, so any change here is rather dangerous. Also the resulting libs could be binary incompatible to the current ones.

Given the age of the code I therefore hesitate a bit from changing such basic constants unless it is really proven to work throughout the code. You could however also ask @mjfitzpatrick for his opinion, since he was the main driver of the 64-bit port of IRAF.

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

No branches or pull requests

2 participants