# uma_zalloc doubt



## fluca1978 (Apr 11, 2013)

Hi, in the file kern/kern_malloc.c the zone for the dynamically allocated memory is created as follows:


```
mt_zone = uma_zcreate("mt_zone", sizeof(struct malloc_type_internal), ...
```

Now, the malloc(9) requests will be managed thru a malloc_type struct that, in turns, contains the malloc_type_internal struct as one of its field (ks_data). The internal struct is bigger than the malloc_type because it includes, in turn, a malloc_type_stats structure not as a pointer (directly). Is this the reason why the _uma_zcreate_ is passed the size of the malloc_type_internal while it will be used to allocate something used thru malloc_type? In other words, should I always pass to _uma_zcreate_ the biggest size of my pieces even if that is not the exact count of bytes I will use?


----------

