How to find what cause Mac OS kernel panic?

For last times i have kernel panics at least once a day. Anyone have suggestions how i can find what cause issue and how to fix it?

I have latest Yosemite updates installed. Here is latest Problem Report showed to me after restart:

Anonymous UUID:       A1261779-EAE0-0E32-F71A-95A171C3FCA0

Sun Jan 25 14:44:17 2015

*** Panic Report ***
panic(cpu 6 caller 0xffffff8009179085): "zalloc: zone map exhausted while allocating from zone kalloc.4096, likely due to memory leak in zone kalloc.64 (1358808192 total bytes, 21231365 elements allocated)"@/SourceCache/xnu/xnu-2782.1.97/osfmk/kern/zalloc.c:2521
Backtrace (CPU 6), Frame : Return Address
0xffffff8116c6b7e0 : 0xffffff800913a811 
0xffffff8116c6b860 : 0xffffff8009179085 
0xffffff8116c6b990 : 0xffffff8009142ef1 
0xffffff8116c6b9c0 : 0xffffff800965e513 
0xffffff8116c6ba00 : 0xffffff7f8b928bc3 
0xffffff8116c6ba20 : 0xffffff7f8b35ad66 
0xffffff8116c6ba50 : 0xffffff7f8b348083 
0xffffff8116c6bad0 : 0xffffff7f8b34c938 
0xffffff8116c6bb20 : 0xffffff7f8b34d6a0 
0xffffff8116c6bb60 : 0xffffff80097026df 
0xffffff8116c6bbc0 : 0xffffff8009700003 
0xffffff8116c6bd00 : 0xffffff80091ea517 
0xffffff8116c6be10 : 0xffffff800913e91c 
0xffffff8116c6be40 : 0xffffff80091235a3 
0xffffff8116c6be90 : 0xffffff8009133e8d 
0xffffff8116c6bf10 : 0xffffff800920a142 
0xffffff8116c6bfb0 : 0xffffff800923ac66 
      Kernel Extensions in backtrace:
         com.apple.iokit.IOAcceleratorFamily2(156.4)[20DDCE61-E3EC-3CC1-8B79-170CEF2B603A]@0xffffff7f8b331000->0xffffff7f8b39dfff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[766FC23F-452C-3B74-951C-598BB17BCF06]@0xffffff7f898fe000
            dependency: com.apple.iokit.IOGraphicsFamily(2.4.1)[6D99A3BE-D531-3780-880B-13F2FC894A4A]@0xffffff7f89fc0000
         com.apple.driver.AppleIntelHD4000Graphics(10.0)[0366E97A-E399-3B2C-B20F-622F995E3056]@0xffffff7f8b911000->0xffffff7f8b96afff
            dependency: com.apple.iokit.IOSurface(97)[B4E2654D-4087-3875-9D59-E899A0A04F0E]@0xffffff7f8a76b000
            dependency: com.apple.iokit.IOPCIFamily(2.9)[766FC23F-452C-3B74-951C-598BB17BCF06]@0xffffff7f898fe000
            dependency: com.apple.iokit.IOGraphicsFamily(2.4.1)[6D99A3BE-D531-3780-880B-13F2FC894A4A]@0xffffff7f89fc0000
            dependency: com.apple.iokit.IOAcceleratorFamily2(156.4)[20DDCE61-E3EC-3CC1-8B79-170CEF2B603A]@0xffffff7f8b331000

BSD process name corresponding to current thread: WindowServer

Mac OS version:
14B25

Kernel version:
Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64
Kernel UUID: 89E10306-BC78-3A3B-955C-7C4922577E61
Kernel slide:     0x0000000008e00000
Kernel text base: 0xffffff8009000000
__HIB  text base: 0xffffff8008f00000
System model name: MacBookPro10,1 (Mac-C3EC7CD22292981F)

System uptime in nanoseconds: 161931714262650
vm objects:53860080
vm object hash entri:8459760
VM map entries:12241360
pv_list:38989824
vm pages:130361920
kalloc.16:94937744
kalloc.32:286054272
kalloc.64:1358808192
kalloc.128:349286400
kalloc.256:675852288
kalloc.512:92835840
kalloc.1024:9658368
kalloc.2048:4542464
kalloc.4096:17313792
kalloc.8192:9232384
mem_obj_control:3396272
sched groups:1244160
wait queue links:1199952
ipc ports:5180640
threads:2531808
x86 fpsave state:1624064
uthreads:1471008
vnodes:31705680
namecache:8478240
HFS node:43336016
HFS fork:16543744
cluster_write:10707400
decmpfs_cnode:4902912
buf.4096:2777088
buf.8192:1351680
ubc_info zone:11375760
vnode pager structur:5155040
compressor_pager:5476352
compressor_segment:5834592
Kernel Stacks:4964352
PageTables:729550848
Kalloc.Large:38095657

Backtrace suspected of leaking: (outstanding bytes: 10368)
0xffffff8009179486
0xffffff8009142ef1
0xffffff800965e513
0xffffff8009661027
0xffffff80096b06f1
0xffffff80096b6dd0
0xffffff7f8be04cc4
0xffffff7f8bdffb0c
      Kernel Extensions in backtrace:
         com.razer.common.razerhid(10.38)[7C8DF659-BD3E-3512-8C1B-9F631993A023]@0xffffff7f8bdfa000->0xffffff7f8be12fff
            dependency: com.apple.iokit.IOUSBFamily(705.4.14)[E15E9DC8-410F-3612-8371-E5FECD939E0D]@0xffffff7f89932000
            dependency: com.apple.iokit.IOHIDFamily(2.0.0)[917971EF-5947-3DF5-BB9F-D353D05C0484]@0xffffff7f89b1f000
            dependency: com.apple.iokit.IOUSBHIDDriver(705.4.0)[2CB055E6-0535-39A2-A393-F8FECDA6863B]@0xffffff7f89ba9000
            dependency: com.apple.driver.IOBluetoothHIDDriver(4.3.1f2)[12CE576E-DC6B-3F99-A180-909E93DAF5C3]@0xffffff7f8bde8000

last loaded kext at 101108773982562: com.apple.iokit.SCSITaskUserClient 3.7.0 (addr 0xffffff7f8be5c000, size 36864)
last unloaded kext at 133588602599357: com.apple.iokit.IOUSBMassStorageClass    3.7.0 (addr 0xffffff7f8be31000, size 69632)
loaded kexts:
jp.co.yamaha.driver.YamahaSteinbergUSBAudio 1.8.32
com.razer.common.razerhid   10.38
com.paceap.kext.pacesupport.snowleopard 5.7.2
com.Cycling74.driver.Soundflower    1.6.2
com.apple.driver.AppleHWSensor  1.9.5d0
com.apple.driver.AGPM   100.14.37
com.apple.driver.ApplePlatformEnabler   2.1.0d1
com.apple.driver.X86PlatformShim    1.0.0
com.apple.filesystems.autofs    3.0
com.apple.iokit.IOBluetoothSerialManager    4.3.1f2
com.apple.driver.AppleMikeyHIDDriver    124
com.apple.driver.AppleOSXWatchdog   1
com.apple.driver.AppleMikeyDriver   267.0
com.apple.driver.AppleHDA   267.0
com.apple.driver.AppleUpstreamUserClient    3.6.1
com.apple.driver.AudioAUUC  1.70
com.apple.GeForce   10.0.0
com.apple.iokit.IOUserEthernet  1.0.1
com.apple.driver.AppleIntelHD4000Graphics   10.0.0
com.apple.driver.AppleSMCLMU    2.0.4d1
com.apple.driver.AppleMCCSControl   1.2.10
com.apple.driver.AppleSMCPDRC   1.0.0
com.apple.driver.AppleLPC   1.7.3
com.apple.driver.AppleMuxControl    3.7.21
com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 4.3.1f2
com.apple.Dont_Steal_Mac_OS_X   7.0.0
com.apple.driver.AppleHWAccess  1
com.apple.driver.AppleHV    1
com.apple.driver.AppleIntelFramebufferCapri 10.0.0
com.apple.driver.AppleThunderboltIP 2.0.2
com.apple.driver.AppleUSBTCButtons  240.2
com.apple.driver.AppleUSBTCKeyboard 240.2
com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0d1
com.apple.BootCache 35
com.apple.driver.XsanFilter 404
com.apple.driver.AppleUSBHub    705.4.1
com.apple.iokit.IOAHCIBlockStorage  2.6.5
com.apple.driver.AppleSDXC  1.6.5
com.apple.driver.AirPort.Brcm4360   901.19.10
com.apple.driver.AppleAHCIPort  3.0.7
com.apple.driver.AppleUSBEHCI   705.4.14
com.apple.driver.AppleUSBXHCI   705.4.14
com.apple.driver.AppleSmartBatteryManager   161.0.0
com.apple.driver.AppleRTC   2.0
com.apple.driver.AppleACPIButtons   3.1
com.apple.driver.AppleHPET  1.8
com.apple.driver.AppleSMBIOS    2.1
com.apple.driver.AppleACPIEC    3.1
com.apple.driver.AppleAPIC  1.7
com.apple.driver.AppleIntelCPUPowerManagementClient 218.0.0
com.apple.nke.applicationfirewall   161
com.apple.security.quarantine   3
com.apple.security.TMSafetyNet  8
com.apple.driver.AppleIntelCPUPowerManagement   218.0.0
com.apple.driver.IOBluetoothHIDDriver   4.3.1f2
com.apple.kext.triggers 1.0
com.apple.iokit.IOSerialFamily  11
com.apple.driver.DspFuncLib 267.0
com.apple.kext.OSvKernDSPLib    1.15
com.apple.nvidia.driver.NVDAGK100Hal    10.0.0
com.apple.nvidia.driver.NVDAResman  10.0.0
com.apple.iokit.IOSurface   97
com.apple.driver.AppleSMBusPCI  1.0.12d1
com.apple.driver.AppleSMBusController   1.0.13d1
com.apple.driver.AppleBacklightExpert   1.1.0
com.apple.iokit.IONDRVSupport   2.4.1
com.apple.driver.AppleGraphicsControl   3.7.21
com.apple.iokit.IOAudioFamily   200.6
com.apple.vecLib.kext   1.2.0
com.apple.iokit.IOBluetoothHostControllerUSBTransport   4.3.1f2
com.apple.iokit.IOBluetoothFamily   4.3.1f2
com.apple.driver.AppleHDAController 267.0
com.apple.iokit.IOHDAFamily 267.0
com.apple.iokit.IOUSBUserClient 705.4.0
com.apple.iokit.IOAcceleratorFamily2    156.4
com.apple.AppleGraphicsDeviceControl    3.7.21
com.apple.iokit.IOGraphicsFamily    2.4.1
com.apple.driver.X86PlatformPlugin  1.0.0
com.apple.driver.AppleSMC   3.1.9
com.apple.driver.IOPlatformPluginFamily 5.8.0d49
com.apple.iokit.IOSCSIArchitectureModelFamily   3.7.0
com.apple.driver.AppleUSBMultitouch 245.2
com.apple.iokit.IOUSBHIDDriver  705.4.0
com.apple.driver.AppleUSBMergeNub   705.4.0
com.apple.driver.AppleUSBComposite  705.4.9
com.apple.driver.CoreStorage    471
com.apple.driver.AppleThunderboltDPInAdapter    4.0.6
com.apple.driver.AppleThunderboltDPAdapterFamily    4.0.6
com.apple.driver.AppleThunderboltPCIDownAdapter 2.0.2
com.apple.driver.AppleThunderboltNHI    3.1.7
com.apple.iokit.IOThunderboltFamily 4.2.1
com.apple.iokit.IO80211Family   700.52
com.apple.driver.mDNSOffloadUserClient  1.0.1b8
com.apple.iokit.IONetworkingFamily  3.2
com.apple.iokit.IOAHCIFamily    2.7.0
com.apple.iokit.IOUSBFamily 705.4.14
com.apple.driver.AppleEFINVRAM  2.0
com.apple.driver.AppleEFIRuntime    2.0
com.apple.iokit.IOHIDFamily 2.0.0
com.apple.iokit.IOSMBusFamily   1.1
com.apple.security.sandbox  300.0
com.apple.kext.AppleMatch   1.0.0d1
com.apple.driver.AppleKeyStore  2
com.apple.driver.AppleMobileFileIntegrity   1.0.5
com.apple.driver.AppleCredentialManager 1.0
com.apple.driver.DiskImages 389.1
com.apple.iokit.IOStorageFamily 2.0
com.apple.iokit.IOReportFamily  31
com.apple.driver.AppleFDEKeyStore   28.30
com.apple.driver.AppleACPIPlatform  3.1
com.apple.iokit.IOPCIFamily 2.9
com.apple.iokit.IOACPIFamily    1.4
com.apple.kec.pthread   1
com.apple.kec.corecrypto    1.0
com.apple.kec.Libm  1

System Profile:
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xEF), Broadcom BCM43xx 1.0 (7.15.124.12.10)
Bluetooth: Version 4.3.1f2 15015, 3 services, 27 devices, 1 incoming serial ports
Thunderbolt Bus: MacBook Pro, Apple Inc., 23.4
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x802C, 0x384A54463235363634485A2D3147364D3120
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x802C, 0x384A54463235363634485A2D3147364D3120
USB Device: Hub
USB Device: Steinberg UR22
USB Device: Hub
USB Device: Apple Internal Keyboard / Trackpad
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: Hub
USB Device: FaceTime HD Camera (Built-in)
Serial ATA Device: APPLE SSD SD256E, 251 GB
Model: MacBookPro10,1, BootROM MBP101.00EE.B05, 4 processors, Intel Core i7, 2.4 GHz, 8 GB, SMC 2.3f35
Network Service: Wi-Fi, AirPort, en0
Graphics: Intel HD Graphics 4000, Intel HD Graphics 4000, Built-In
Graphics: NVIDIA GeForce GT 650M, NVIDIA GeForce GT 650M, PCIe, 1024 MB
Model: MacBookPro10,1, BootROM MBP101.00EE.B05, 4 processors, Intel Core i7, 2.4 GHz, 8 GB, SMC 2.3f35
Graphics: Intel HD Graphics 4000, Intel HD Graphics 4000, Built-In
Graphics: NVIDIA GeForce GT 650M, NVIDIA GeForce GT 650M, PCIe, 1024 MB
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x802C, 0x384A54463235363634485A2D3147364D3120
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x802C, 0x384A54463235363634485A2D3147364D3120
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xEF), Broadcom BCM43xx 1.0 (7.15.124.12.10)
Bluetooth: Version 4.3.1f2 15015, 3 services, 27 devices, 1 incoming serial ports
Serial ATA Device: APPLE SSD SD256E, 251 GB
USB Device: Hub
USB Device: FaceTime HD Camera (Built-in)
USB Device: Hub
USB Device: Steinberg UR22
USB Device: Hub
USB Device: Apple Internal Keyboard / Trackpad
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 23.4

Solution 1:

The reason for your panic is right near the top:

panic(cpu 6 caller 0xffffff8009179085): "zalloc: zone map exhausted while allocating from zone kalloc.4096, likely due to memory leak in zone kalloc.64 (1358808192 total bytes, 21231365 elements allocated)"@/SourceCache/xnu/xnu-2782.1.97/osfmk/kern/zalloc.c:2521

Something is completely depleting the zone allocator. I've never seen a memory leak in any of Apple's kexts, and although it is possible that it's Apple's fault, it seems more likely to be a third-party kext causing the problem.

Indeed, the kernel keeps track of some diagnostics, and goes on to take a guess:

Backtrace suspected of leaking: (outstanding bytes: 10368)
0xffffff8009179486
0xffffff8009142ef1
0xffffff800965e513
0xffffff8009661027
0xffffff80096b06f1
0xffffff80096b6dd0
0xffffff7f8be04cc4
0xffffff7f8bdffb0c
      Kernel Extensions in backtrace:
         com.razer.common.razerhid(10.38)[7C8DF659-BD3E-3512-8C1B-9F631993A023]@0xffffff7f8bdfa000->0xffffff7f8be12fff
            dependency: com.apple.iokit.IOUSBFamily(705.4.14)[E15E9DC8-410F-3612-8371-E5FECD939E0D]@0xffffff7f89932000
            dependency: com.apple.iokit.IOHIDFamily(2.0.0)[917971EF-5947-3DF5-BB9F-D353D05C0484]@0xffffff7f89b1f000
            dependency: com.apple.iokit.IOUSBHIDDriver(705.4.0)[2CB055E6-0535-39A2-A393-F8FECDA6863B]@0xffffff7f89ba9000
            dependency: com.apple.driver.IOBluetoothHIDDriver(4.3.1f2)[12CE576E-DC6B-3F99-A180-909E93DAF5C3]@0xffffff7f8bde8000

So, a likely culprit is com.razer.common.razerhid, which looks like it might be a driver for a mouse, game controller, keyboard or other input device.

Check the manufacturer's website for an updated version of the driver, or send them the above log if there isn't one. You may also want to uninstall the driver until they fix it if that's the case.