I have some question to the following code:
Qt Code:
  1. int size = buffer.size();
  2.  
  3. if (!sharedMemory.create(size)) {
  4. ui.label->setText(tr("Unable to create shared memory segment."));
  5. return;
  6. }
  7. sharedMemory.lock();
  8. char *to = (char*)sharedMemory.data();
  9. const char *from = buffer.data().data();
  10. memcpy(to, from, qMin(sharedMemory.size(), size));
  11. sharedMemory.unlock();
To copy to clipboard, switch view to plain text mode 

1.
Qt Code:
  1. sharedMemory.create(size)
To copy to clipboard, switch view to plain text mode 
Creates a shared memory segment of size bytes,Why sharedMemory.size() != size?
2.In addition, it seems like not sure about which one is big between sharedMemory.size() and
Qt Code:
  1. size(qMin(sharedMemory.size(), size)
To copy to clipboard, switch view to plain text mode 
) ?


thanks very much for any advice!