Page 1 of 1
Specify per project stack size?
Posted: Sat Feb 09, 2008 1:07 am
by PeterM
To cater for Quake's hefty stack requirements I've had to increase the stack from 128K to 256K. It used to be 512, but I did some optimisation in R_RecursiveWorldNode to take the usage down.
I was wondering if there is a way to do this on a per .elf basis instead of modifying the global ogc.ld linkscript?
Thanks!
Re: Specify per project stack size?
Posted: Mon Feb 11, 2008 5:21 pm
by WinterMute
That might be a useful feature to have actually.
You can adjust the stack size per thread using LWP_CreateThread though and, fwiw, the main function in a libogc app is actually the first thread started by the microkernel.
So, something like this will let you manage the stack size in your code.
Code: Select all
static lwp_t hmain_game = (lwp_t)NULL;
int main()
{
...
setup code
...
LWP_CreateThread( /* thread handle */ &hmain_game, /* code */ main_game, /* arg pointer for thread */ NULL, /* stack base */ NULL, /* stack size */ 512*1024, /* thread priority */ 50);
LWP_SetThreadPriority(0,0);
while(1);
}
static void* main_game(void *arg)
{
...
interesting stuff
...
}