Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 61410 Details for
Bug 96409
SDL_CreateThread leaks virtual address space
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Example program to demonstrate leak
thread_waste.c (text/plain), 1.08 KB, created by
qube99
on 2005-06-17 12:54:28 UTC
(
hide
)
Description:
Example program to demonstrate leak
Filename:
MIME Type:
Creator:
qube99
Created:
2005-06-17 12:54:28 UTC
Size:
1.08 KB
patch
obsolete
> >#include <unistd.h> > >#ifdef USE_SDL >#include <SDL/SDL.h> >#include <SDL/SDL_thread.h> >#else >#include <pthread.h> >#endif > >int zero = 0; > >// Thread that immediately exits. >#ifdef USE_SDL >int waste_thread(void *unused __attribute__ ((unused))) >#else >void *waste_thread() >#endif >{ > //Do nothing. >#ifdef USE_SDL > return 0; >#else > pthread_exit(&zero); >#endif >} > >int usage(char *name) >{ > printf("Usage: %s <time_to_run>\n", name); > return 1; >} > >int main(int argc, char *argv[]) >{ > int time, i; >#ifndef USE_SDL > pthread_attr_t attr; > pthread_t child; >#endif > > if (argc != 2) > return usage(argv[0]); > > time = atoi(argv[1]); > > if (time < 1) > return usage(argv[0]); > > for (i = 0; i < time; i++) { >#ifdef USE_SDL > SDL_CreateThread(waste_thread, NULL); >#else > pthread_attr_init(&attr); > // Make it detached. > pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); > // // And one-to-one with kernel threads. > pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); > pthread_create(&child, &attr, waste_thread, NULL); >#endif > // Sleep a second. > sleep(1); > } > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 96409
: 61410