#ifndef _OALLOC_H
#define _OALLOC_H

/*
Oalloc library: these functions are best used when you need to
dynamically allocate thousands (or millions, or ...) of little objects
(even single bytes), none of which will ever be individually freed but
*all* of which may be simultaneously freed at a later time.  Thus,
Omalloc and Ocalloc act like their system counterparts, except you
cannot free individual objects allocated by them.  A call to Ofree will
free *all* the memory that was allocated by Omalloc and Ocalloc, and
they will be reset so you can do it all over again.  All these functions
should be very fast and memory efficient.

Implementation details: They work by malloc'ing a large chunk of memory
and then divying it up as needed, with zero space between your objects
within a chunk (modulo alignment requirements).  If the chunk runs out of
space, a new chunk is malloc'd.  All chunks are remembered so that
a call to Ofree frees all the chunks.

Orealloc can't be implemented, because we don't know the size of the old
storage, so we don't know how much to copy over, and just copying over
the new space may result in memory faults while reading past the end of
the old space.
*/

void *Omalloc(unsigned n);
void *Ocalloc(unsigned n, size_t s);

void Ofree(void);   /* note there are no arguments */

#endif /* _OALLOC_H */
