- my_bufp = (char *) malloc( (my_page_size * 10) );
- if ( my_bufp == NULL ) {
- printf( "malloc failed with error %d - \"%s\" \n", errno, strerror( errno) );
+ my_kr = vm_allocate((vm_map_t) mach_task_self(), (vm_address_t*)&my_bufp, (my_page_size * 10), VM_FLAGS_ANYWHERE);
+ if(my_kr != KERN_SUCCESS){
+ printf( "vm_allocate failed with error %d - \"%s\" \n", errno, strerror( errno) );
+ my_err = -1;
+ goto exit_child;
+ }
+
+ /* test madvise on anonymous memory */
+ my_err = madvise(my_bufp, (my_page_size * 10), MADV_WILLNEED);
+ if ( my_err == -1 ) {
+ printf("madvise WILLNEED on anon memory failed with error %d - \"%s\" \n", errno, strerror( errno ) );