- xbt_swag_remove(arg, simix_global->process_list);
- xbt_swag_remove(arg, simix_global->process_to_run);
- xbt_swag_remove(arg, ((smx_process_t) arg)->simdata->host->simdata->process_list);
- free(((smx_process_t) arg)->name);
- ((smx_process_t) arg)->name = NULL;
- free(((smx_process_t) arg)->simdata);
- ((smx_process_t) arg)->simdata = NULL;
- free(arg);
-}
-
-/** \ingroup m_process_management
- * \brief Creates and runs a new #m_process_t.
-
- * A constructor for #m_process_t taking four arguments and returning the
- * corresponding object. The structure (and the corresponding thread) is
- * created, and put in the list of ready process.
- * \param name a name for the object. It is for user-level information
- and can be NULL.
- * \param code is a function describing the behavior of the agent. It
- should then only use functions described in \ref
- m_process_management (to create a new #m_process_t for example),
- in \ref m_host_management (only the read-only functions i.e. whose
- name contains the word get), in \ref m_task_management (to create
- or destroy some #m_task_t for example) and in \ref
- msg_gos_functions (to handle file transfers and task processing).
- * \param data a pointer to any data one may want to attach to the new
- object. It is for user-level information and can be NULL. It can
- be retrieved with the function \ref MSG_process_get_data.
- * \param host the location where the new agent is executed.
- * \param argc first argument passed to \a code
- * \param argv second argument passed to \a code
- * \see m_process_t
- * \return The new corresponding object.
+ DEBUG1("Cleanup process %s", process->name);
+ /*xbt_swag_remove(process, simix_global->process_to_run);*/
+ xbt_swag_remove(process, simix_global->process_list);
+ xbt_swag_remove(process, process->smx_host->process_list);
+ xbt_swag_insert(process, simix_global->process_to_destroy);
+}
+
+/**
+ * Garbage collection
+ *
+ * Should be called some time to time to free the memory allocated for processes
+ * that have finished (or killed).