From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,820f787511078c56 X-Google-Attributes: gidfee84,public From: M. van Wijk Subject: RE: swap/malloc problem Date: 1996/06/08 Message-ID: <01bb5549.273b6c80$b6de5982@Baldrick.student.utwente.nl>#1/1 X-Deja-AN: 159146489 references: <4p9kis$6sg@netnews.upenn.edu> organization: Pakjes B.V. newsgroups: comp.unix.osf.osf1 On Friday, June 07, 1996, George Grevera wrote... > The program that bombs is simply: > > #include > #include > #include > > int main ( int argc, char* argv[] ) { > char* cp = malloc(135000000); > assert(cp != NULL); > } > > I can't understand why this fails. Thanks for your help. I'm afraid I can't understand either. I think they assumed nobody wants to allocate such an amount of memory. But I found a workaround! Surprisingly, it works if you link with -lpthreads -lmach. The ptreads library contains thread safe versions of some libc calls, including malloc. Somehow that malloc can handle bigger requests. Marc van Wijk m.vanwijk@student.utwente.nl