Change object ID allocation logic to slow down ID reuse

Reusing object IDs fast can result in more problems with buggy clients,
as such a client might then operate on the wrong object.

If reuse of object ID is slowed down then a buggy client is more likely
to see an unknown-object-id error, instead of using the wrong object.

The current object ID allocation has an O(n^2) implementation, this
should be improved.
Fix array handling in list_get_item function
Dereference double pointers more early in inventory handling
Only send process-state-changed callbacks for externally references process objects
Remove unnecessary checks for NULL

Program command/arguments/environment cannot be NULL.
Add stdio configuration to program object API