mdMalloc(3dm)							 mdMalloc(3dm)
      mdMalloc, mdFree, mdCallMalloc, mdCallFree, mdSetAllocator	- control
     memory allocation for the MIDI library
     #include <dmedia/midi.h>
     typedef void *(*mdMalloc_t)(size_t);
     typedef void (*mdFree_t)(void *);
     mdMalloc_t	mdMalloc;
     mdFree_t mdFree;
     mdCallMalloc(size_t len);
     mdCallFree(void *arg);
     void mdSetAllocator(mdMalloc_t malloc_func, mdFree_t free_func, void *ap)
     mdMalloc and mdFree are pointers to memory	allocation functions used by
     the MIDI library.	The default implementations use	the amalloc(3P)
     library to	implement an arena separate from the main heap used by
     malloc(3C).  This allows memory performance in the	MIDI library to	be
     maintained	in the presence	of high	malloc usage by	an application.
     mdMalloc is used by mdReceive(3dm)	to allocate storage for	incoming MIDI
     system exclusive messages.	 mdFree	is used	by the application to release
     that storage.
     mdMalloc and mdFree are mp-safe.
     mdSetAllocator allows an application to override the any of the
     following:	mdMalloc (via malloc_func), mdFree (via	free_func) or the
     storage arena (via	ap).  When using one's own arena, the default behavior
     of	the storage allocator may be changed via amallopt(3P).	If all three
     are overridden, the behavior of the storage allocator is completely under
     application control.
     mdCallMalloc and mdCallFree are routines used to call the current
     allocation	or deallocation	routine, respectively.	These are actual
     routines, not pointers.
     mdMalloc returns a	pointer	to a block of memory at	least len bytes	long,
     or	NULL if	no storage can be allocated.
     mdIntro(3dm), mdReceive(3dm)
									PPPPaaaaggggeeee 1111 [ Back ]
 |