cast size_t for printf mem output, c99 may not be available