+
+ void* buf = request->buf;
+ if ( (request->flags & SSEND) == 0
+ && ( (request->flags & RMA) != 0 || static_cast<int>(request->size) < xbt_cfg_get_int("smpi/send-is-detached-thresh") ) ) {
+ void *oldbuf = nullptr;
+ request->detached = 1;
+ XBT_DEBUG("Send request %p is detached", request);
+ request->refcount++;
+ if(request->old_type->sizeof_substruct == 0){
+ oldbuf = request->buf;
+ if (!smpi_process_get_replaying() && oldbuf != nullptr && request->size!=0){
+ if((smpi_privatize_global_variables != 0)
+ && (static_cast<char*>(request->buf) >= smpi_start_data_exe)
+ && (static_cast<char*>(request->buf) < smpi_start_data_exe + smpi_size_data_exe )){
+ XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment ");
+ smpi_switch_data_segment(request->src);
+ }
+ buf = xbt_malloc(request->size);
+ memcpy(buf,oldbuf,request->size);
+ XBT_DEBUG("buf %p copied into %p",oldbuf,buf);
+ }
+ }
+ }
+
+ //if we are giving back the control to the user without waiting for completion, we have to inject timings