add support for memory allocation callbacks

added an _alloc variation for each of the load functions that allows the user to supply callbacks for custom memory management