Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-07-2009, 03:19 AM   #1
LQ Newbie
Registered: Mar 2009
Posts: 3

Rep: Reputation: 0
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.
Old 04-07-2009, 08:51 AM   #2
LQ Guru
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190
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?
Old 04-07-2009, 08:58 AM   #3
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,791
Blog Entries: 4

Rep: Reputation: 3079Reputation: 3079Reputation: 3079Reputation: 3079Reputation: 3079Reputation: 3079Reputation: 3079Reputation: 3079Reputation: 3079Reputation: 3079Reputation: 3079
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."


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
32 bit OS and 4GB memory limit the_gripmaster Linux - General 51 03-02-2017 08:22 PM
32 bit Application on 64 bit Linux OS -- Memory Usage saleem_ak Linux - Newbie 3 04-01-2009 03:59 PM
4GB on 32-bit Debian? sycamorex Debian 6 07-03-2007 12:52 PM
4GB RAM: 64-bit Opteron Problems deviance99 Linux - Hardware 6 06-22-2004 09:24 PM
What's the Max XP memory ( 4GB ? ) deft General 3 01-21-2004 12:16 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration