#include <malloc.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define N 1 typedef struct _acme { int data; } * acme; int main(void) { acme gizmo[N]; gizmo[0] = (acme)malloc(sizeof(struct _acme)); size_t msize = malloc_usable_size(gizmo[0]); printf("malloc_usable_size(gizmo[0]) %lu\n", msize); free(gizmo[0]); return (1); }
This always allocates 24 bytes - whatever i pass to malloc. I’m a bit confused. What do i miss? Thanks in advance for enlightenment.
Update: Thanks to all for the kind and helpful replies.
In reply to OT: Why does malloc always give me 24? [SOLVED] by karlgoethebier
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |