In zalloc.c at line 662, this code can be found: if (zone->collectable) { vm_offset_t space; vm_size_t alloc_size; if (vm_pool_low()) alloc_size = round_page(zone->elem_size); else alloc_size = zone->alloc_size; retval = kernel_memory_allocate(zone_map, &space, alloc_size, 0, KMA_KOBJECT|KMA_NOPAGEWAIT); if (retval == KERN_SUCCESS) { zone_page_init(space, alloc_size, ZONE_PAGE_USED); zcram(zone, space, alloc_size); } else if (retval != KERN_RESOURCE_SHORTAGE) { /* would like to cause a zone_gc() */ (1) panic("zalloc"); } [...] ---- Q: Instead of panicing at (1), couldn't it just be possible to return NULL? KERN_RESOURCE_SHORTAGE is described as: /* A system resource could not be allocated to fulfill * this request. This failure may not be permanent. */ The issue is that once you "Kernel Panic"ed, it's 'permanent' till the next reboot. _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Stéphane Sudre