I am trying to debug a peculiar problem with malloc()
failure inside a KEXT, when it is trying to allocate a struct of 9184 bytes size.
malloc() returns ENOMEM after about 1139 such allocations – that’s
just under 10MB. This problem is only reproducible on the two Mac Pros with
2GB RAM and Mac OS X 10.4.11. I panic’ed the system in the KEXT just
after malloc returned error. Using zprint in gdb, I checked various
memory zones and comparing the TOT_SZ and MAX_SZ, I can see 1 zone to be
running out of space. However, if ELT_SZ is the allocation size of each
element in the zone, it does not match the allocation that is failing.
ZONE COUNT
TOT_SZ MAX_SZ ELT_SZ ALLOC_SZ
NAME
0x01f6ee40 2438
2bdfdc 2be000
44 1000
kernel map entries
I have tried building the KEXT on a couple of Mac OS X and
XCode combinations – 10.4.7+XCode2.5, 10.5.6+XCode3.1.2.
How do I debug this problem?
Is there a way to find out which zone is being used for malloc()?
What do all the labels in zprint actually mean?
Thanks,
-s.