typedef struct _malloc_zone_t {
/* Only zone implementors should depend on the layout of this structure;
Regular callers should use the access functions below */
- unsigned version;
- void *reserved2;
+ void *reserved1; /* RESERVED FOR CFAllocator DO NOT USE */
+ void *reserved2; /* RESERVED FOR CFAllocator DO NOT USE */
size_t (*size)(struct _malloc_zone_t *zone, const void *ptr); /* returns the size of a block or 0 if not in this zone; must be fast, especially for negative answers */
void *(*malloc)(struct _malloc_zone_t *zone, size_t size);
void *(*calloc)(struct _malloc_zone_t *zone, size_t num_items, size_t size); /* same as malloc, but block returned is set to zero */
void (*batch_free)(struct _malloc_zone_t *zone, void **to_be_freed, unsigned num_to_be_freed); /* frees all the pointers in to_be_freed; note that to_be_freed may be overwritten during the process */
struct malloc_introspection_t *introspect;
- void *reserved5;
+ unsigned version;
} malloc_zone_t;
/********* Creation and destruction ************/
extern size_t malloc_size(const void *ptr);
/* Returns size of given ptr */
+extern size_t malloc_good_size(size_t size);
+ /* Returns number of bytes greater than or equal to size that can be allocated without padding */
+
/********* Batch methods ************/
extern unsigned malloc_zone_batch_malloc(malloc_zone_t *zone, size_t size, void **results, unsigned num_requested);
If address==0 nothing is logged;
If address==-1 all activity is logged;
Else only the activity regarding address is logged */
+
+struct mstats {
+ size_t bytes_total;
+ size_t chunks_used;
+ size_t bytes_used;
+ size_t chunks_free;
+ size_t bytes_free;
+};
+
+extern struct mstats mstats(void);
+
__END_DECLS
#endif /* _MALLOC_MALLOC_H_ */