@brief Set the world to use shared working memory along with another world.
The worlds allocate working memory internally for simulation stepping. This
memory is cached among the calls to @c dWordStep and @c dWorldQuickStep.
Similarly, several worlds can be set up to share this memory caches thus
reducing overall memory usage by cost of making worlds inappropriate for
simultaneous simulation in multiple threads.
If null value is passed for @a from_world parameter the world is detached from
sharing and returns to defaults for working memory, reservation policy and
memory manager as if just created. This can also be used to enable use of shared
memory for a world that has already had working memory allocated privately.
Normally using shared memory after a world has its private working memory allocated
is prohibited.
Allocation policy used can only increase world's internal reserved memory size
and never decreases it. @c dWorldCleanupWorkingMemory can be used to release
working memory for a world in case if number of objects/joint decreases
significantly in it.
With sharing working memory worlds also automatically share memory reservation
policy and memory manager. Thus, these parameters need to be customized for
initial world to be used as sharing source only.
Failure result status means a memory allocation failure.
@param w The world to use the shared memory with.
@param from_world Null or the world the shared memory is to be used from.
@returns 1 for success and 0 for failure.
@ingroup world
@see dWorldCleanupWorkingMemory
@see dWorldSetStepMemoryReservationPolicy
@see dWorldSetStepMemoryManager
@brief Set the world to use shared working memory along with another world.
The worlds allocate working memory internally for simulation stepping. This memory is cached among the calls to @c dWordStep and @c dWorldQuickStep. Similarly, several worlds can be set up to share this memory caches thus reducing overall memory usage by cost of making worlds inappropriate for simultaneous simulation in multiple threads.
If null value is passed for @a from_world parameter the world is detached from sharing and returns to defaults for working memory, reservation policy and memory manager as if just created. This can also be used to enable use of shared memory for a world that has already had working memory allocated privately. Normally using shared memory after a world has its private working memory allocated is prohibited.
Allocation policy used can only increase world's internal reserved memory size and never decreases it. @c dWorldCleanupWorkingMemory can be used to release working memory for a world in case if number of objects/joint decreases significantly in it.
With sharing working memory worlds also automatically share memory reservation policy and memory manager. Thus, these parameters need to be customized for initial world to be used as sharing source only.
Failure result status means a memory allocation failure.
@param w The world to use the shared memory with. @param from_world Null or the world the shared memory is to be used from. @returns 1 for success and 0 for failure.
@ingroup world @see dWorldCleanupWorkingMemory @see dWorldSetStepMemoryReservationPolicy @see dWorldSetStepMemoryManager