change alloc type from int to size_t