FreeBSD Bugzilla – Attachment 228635 Details for
Bug 259076
pthread_mutex_init fails with limited AS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
0 mutexes bug
nomem.c (text/plain), 747 bytes, created by
Denis Koreshkov
on 2021-10-12 19:35:55 UTC
(
hide
)
Description:
0 mutexes bug
Filename:
MIME Type:
Creator:
Denis Koreshkov
Created:
2021-10-12 19:35:55 UTC
Size:
747 bytes
patch
obsolete
>#include <sys/time.h> >#include <sys/resource.h> >#include <sys/mman.h> >#include <malloc_np.h> >#include <pthread.h> >#include <stdbool.h> >#include <stdio.h> >#include <stdlib.h> > >void *a[100000]; > >int >main() >{ > pthread_mutex_t t; > int i, j, sz = 1<<18, lim = 1<<26; > > struct rlimit rl = { lim,lim }; > setrlimit(RLIMIT_AS,&rl); > > bool ena = false; > mallctl("opt.retain", NULL, NULL, &ena, sizeof ena); > > //pthread_mutex_init(&t,NULL); > for(j=0;j<100000;j++) { > a[j]=malloc(sz); > if(a[j]==0) > break; > } > printf("alloc %d Kbytes\n", j*sz/1024); > for(i=0;i<j;i++) > free(a[i]); > printf("freed %d Kbytes\n", j*sz/1024); > > for(i=0;i<1000000;i++) > if (pthread_mutex_init(&t,NULL)) > break; > printf("%d mutexes: %d Kbytes\n",i,i*128/1024); > 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 259076
: 228635