LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   32-bit application accessing memory more than 4GB (https://www.linuxquestions.org/questions/linux-newbie-8/32-bit-application-accessing-memory-more-than-4gb-717355/)

parthi_s 04-07-2009 02:19 AM

32-bit application accessing memory more than 4GB
 
hi all,

how can a 32-bit application can access memory more than 4GB? actualy am writing a 32 bit application on a 64 bit intel machine and my application needs to access memory more than 4GB. i tried compiling with -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_LARGE_FILE_API -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 options but still i was not able to do that. if any one has any idea please do share!!

thanks in advance.

johnsfine 04-07-2009 07:51 AM

You cannot have more than 4GB mapped at any one moment by a 32bit application.

There are work arounds, but none of them are likely to take you less effort than simply converting the application to 64 bit.

Any work around would be functionally similar to keeping the large data structures in one or more files and mapping chunks of those files to access the data. If the system has enough physical ram, the unmapped pages at any moment would tend to stay in the system's page cache, so remapping a chunk you had unmapped earlier should not need any actual disk I/O. If the program creates the file on a tmpfs and deletes it when done, there also should be no initial disk I/O before it is "cached".

But all that is complicated. Why not make a 64 bit application?

sundialsvcs 04-07-2009 07:58 AM

Basically, it's a non-issue. If you've got a system with more than 4GB of actual RAM, then it must be a 64-bit-capable system. (Otherwise, you were very-seriously ripped off by a smooth-talking hardware salesman! :))

Therefore, you should compile that application in the appropriate (i.e. 64-bit) mode, and be done with it.

If you do not have access to the source-code of the application, then its (32 vs. 64 bit) memory limitations "are what they are."


All times are GMT -5. The time now is 05:58 AM.