Allocation problem [message #909727] |
Fri, 07 September 2012 12:47  |
Eclipse User |
|
|
|
Hi,
I can't get this to work:
/*
============================================================================
Name : hello.c
Author :
Version :
Copyright :
Description : hello in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int var1[1000000];
printf("%i",var1[0]);
return EXIT_SUCCESS;
}
I see this:
http://www.eclipse.org/forums/index.php/t/255620/
"-Wl,--stack,2097152" does not seem to work...
How can I fix this?
(I do want that array on a bigger stack.)
[Updated on: Fri, 07 September 2012 18:22] by Moderator
|
|
|
Re: Allocation problem [message #910021 is a reply to message #909727] |
Sat, 08 September 2012 07:50   |
Eclipse User |
|
|
|
Now i've done this in linux eclips-cdt:
code:
#include <stdlib.h>
#include <stdio.h>
#include <sys/resource.h>
int main(void)
{
const rlim_t kStackSize = 1024L * 1024L * 1024L;
struct rlimit rl;
int result;
result = getrlimit(RLIMIT_STACK, &rl);
printf("%i (%i)\n",(int)rl.rlim_cur,result);
rl.rlim_cur = kStackSize;
result = setrlimit(RLIMIT_STACK, &rl);
printf("%i (%i)\n",(int)rl.rlim_cur,result);
result = getrlimit(RLIMIT_STACK, &rl);
printf("%i (%i)\n",(int)rl.rlim_cur,result);
int k[2090000];
printf("k\n");
return EXIT_SUCCESS;
}
output:
8388608 (0)
1073741824 (0)
1073741824 (0)
k
code2:
int k[2090000]; ==> int k[2099000];
Setting the RLIMIT_STACK to a bigger value does not seem to help...
Just to be sure: Each program has its own stack right? Because this linux command is throwing me off...
[Updated on: Sat, 08 September 2012 07:59] by Moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03231 seconds