public static void *stbtt__hheap_alloc(stbtt__hheap *hh, ulong size, void *userdata)
 {
     if ((hh->first_free) != null)
     {
         void *p = hh->first_free;
         hh->first_free = *(void **)(p);
         return(p);
     }
     else
     {
         if ((hh->num_remaining_in_head_chunk) == (0))
         {
             int count             = (int)((size) < (32) ? 2000 : (size) < (128) ? 800 : 100);
             stbtt__hheap_chunk *c = (stbtt__hheap_chunk *)(CRuntime.malloc((ulong)((ulong)sizeof(stbtt__hheap_chunk) + size * (ulong)(count))));
             if ((c) == (null))
             {
                 return(null);
             }
             c->next  = hh->head;
             hh->head = c;
             hh->num_remaining_in_head_chunk = (int)(count);
         }
         --hh->num_remaining_in_head_chunk;
         return((sbyte *)(hh->head) + sizeof(stbtt__hheap_chunk) + size * (ulong)hh->num_remaining_in_head_chunk);
     }
 }
        public static void stbtt__hheap_cleanup(stbtt__hheap *hh, void *userdata)
        {
            stbtt__hheap_chunk *c = hh->head;

            while ((c) != null)
            {
                stbtt__hheap_chunk *n = c->next;
                CRuntime.free(c);
                c = n;
            }
        }