Maximum size of data segment used by c program
Hi all, Is there any limit on the maximum data segment size used by c programs? Thanks,
yes there is a limit, look at # man setrlimit RLIMIT_DATA The maximum size of the process's data segment (initialized data, uninitialized data, and heap). This limit affects calls to brk(2) and sbrk(2), which fail with the error ENOMEM upon encountering the soft limit of this resource. -Rajat On Mon, Sep 17, 2012 at 3:11 PM, devendra.aaru <devendra.aaru@gmail.com>wrote:
Hi all,
Is there any limit on the maximum data segment size used by c programs?
Thanks,
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Mon, Sep 17, 2012 at 6:17 AM, Rajat Sharma <fs.rajat@gmail.com> wrote:
yes there is a limit, look at
getrlimit show the size as 4GiGs of RLIMIT_DATA on a 32-bit. which means that its unlimited? Thanks,
# man setrlimit
RLIMIT_DATA The maximum size of the process's data segment (initialized data, uninitialized data, and heap). This limit affects calls to brk(2) and sbrk(2), which fail with the error ENOMEM upon encountering the soft limit of this resource.
-Rajat
On Mon, Sep 17, 2012 at 3:11 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
Hi all,
Is there any limit on the maximum data segment size used by c programs?
Thanks,
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Mon, Sep 17, 2012 at 6:17 AM, Rajat Sharma <fs.rajat@gmail.com> wrote:
yes there is a limit, look at
getrlimit show the size as 4GiGs of RLIMIT_DATA on a 32-bit. which means that its unlimited?
I mean 4Gigs of RLIMIT_DATA is both the rlim_cur and rlim_max. i have a data section of size 213K, i am thinking that i should not be growing the data section size. I have went through google and didn't found any article that says about the maximum data section a process can use.
Thanks,
On Mon, Sep 17, 2012 at 4:34 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
On Mon, Sep 17, 2012 at 6:17 AM, Rajat Sharma <fs.rajat@gmail.com> wrote:
yes there is a limit, look at
getrlimit show the size as 4GiGs of RLIMIT_DATA on a 32-bit. which means that its unlimited?
I mean 4Gigs of RLIMIT_DATA is both the rlim_cur and rlim_max. i have a data section of size 213K, i am thinking that i should not be growing the data section size.
yes try the c function setrlimit, thats what I meant by looking at man page. #include <sys/time.h> #include <sys/resource.h> int getrlimit(int resource, struct rlimit *rlim); int setrlimit(int resource, const struct rlimit *rlim);
I have went through google and didn't found any article that says about the maximum data section a process can use.
Thanks,
Hi... On Mon, Sep 17, 2012 at 4:41 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
Hi all,
Is there any limit on the maximum data segment size used by c programs?
AFAIK, both heap and stack can grow unlimited, as long as there is enough free space in the user space address space (which is 3 GiB in x86 32 bit). Please note that virtual memory fragmentation in the user space address space could also affect this. The more fragmented, the more likely you will hit "no more free space" -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
participants (3)
-
devendra.aaru -
Mulyadi Santosa -
Rajat Sharma