Questions tagged [qsharedmemory]

In the QT framework, the QSharedMemory class provides access to a shared memory segment.

In the QT framework, the QSharedMemory class provides access to a shared memory segment.

http://qt-project.org/doc/qt-5/qsharedmemory.html

23 questions
49
votes
7 answers

Qt: Best practice for a single instance app protection

QSingleApplication? QMutex? QSharedMemory? I'm looking for something that will work smoothly in Windows, OSX and Linux (Ubuntu). Using Qt 4.7.1
JasonGenX
  • 4,952
  • 27
  • 106
  • 198
4
votes
3 answers

Observe changes in QSharedMemory

I have a QSharedMemory to prevent that two processes of my application are running at the same time. Process A sets the QSharedMemory to "locked" when started. Now my process B sets a value like "please come back to foreground". Is there an easy way…
Simon Warta
  • 10,850
  • 5
  • 40
  • 78
3
votes
1 answer

QSharedMemory is not getting deleted on Application crash

I am implementing an application using Qt C++ where I have used QSharedMemory to restrict multiple instances of the application. Relevant code segment in main.cpp is as follows, QSharedMemory sharedMemory; sharedMemory.setKey(SM_INSTANCE_KEY); if…
Surajeet Bharati
  • 1,363
  • 1
  • 18
  • 36
3
votes
0 answers

How to access shared memory type section by Python

I try to make a Python application read data from a shared memory type section. The location of the shared memory is \Sessions\1\BaseNamedObjects\ObjectName. Do I need to use mmap for read this? If yes, how can I open this shared memory? Like…
3
votes
1 answer

Why QShared Memory create size and returned size() are different

I have a doubt in QSharedMemory if i create a shared memory & it size is less than 4096 the size() function returned 4096. If the created size is greater than 4096, then it return 4096+created size. Eg: QSharedMemory…
Pamba
  • 776
  • 1
  • 16
  • 29
2
votes
0 answers

"unable to set key on lock" while attaching memory with native key in qt

I'm trying to learn how to share memory between Qt and Non-Qt application while having read-write access from both. For now I'm trying to create and then attach already created memory in Qt using native key. While the program can successfully create…
Elveman
  • 21
  • 2
2
votes
2 answers

Pythonic way to copy list to a sip.voidptr from QSharedMemory

I am using PyQT5 and the QSharedMemory class. I am creating a shared memory which can hold up 6 1-byte elements. To copy these elments in the shared memory array I am looping over the elments from the python list like the following snippet: f =…
Kev1n91
  • 3,553
  • 8
  • 46
  • 96
2
votes
1 answer

QT: QSharedMemory is creating multiple segments with the same key

I'm writing an application, for learning purposes, that is composed of two executables. Among other things, each executable creates a shared memory segment of his own (with different keys), after that executable A tries to create a segment using B's…
2
votes
2 answers

QSharedMemory::create() issue

I am trying to write a SingleApplication class that will only allow one instance of the program to be running. I am implementing this using QSharedMemory The program works fine, unless I use a key with the value "42". Is there something wrong I am…
Quaxton Hale
  • 2,460
  • 5
  • 40
  • 71
1
vote
0 answers

QSharedMemory not the same size

QSharedMemory is changing sizes on me. create: ... int size = buffer->size(); qDebug() << "buffer->size()" << size << "points" << points->size() << "share name" << sharedMemoryName; if (!m_sharedMemory->create(size)) { …
1
vote
1 answer

C++/Qt memcpy crash with QSharedMemory

I have a simple function which sends strings (uri links or filepaths) to an already running instance of the application using Qt's (5.5.1) QSharedMemory class. It seems to work correctly for most of the times, but i caught a crash log from a user,…
Hajdu Gábor
  • 329
  • 1
  • 12
1
vote
1 answer

Attach existing Shared Memory with QSharedMemory

In Application 1(C Code) im creating a shared memory like this: char * key_path = "/tmp/shmem"; int file = open(key_path, O_CREAT | O_RDWR | O_APPEND, 0755); close(file); key_t key = ftok(key_path, 1); shmid = shmget (key, SHM_DATASIZE , IPC_CREAT…
mvollmer
  • 187
  • 2
  • 11
1
vote
0 answers

Qt C++ Custom Class for copy and paste on multiple application using QSharedMemory

QT C++ Can I use Custom mime-type for copy and paste on multiple application? After I asked that question, I tried to make a application using QSharedMemory. But When I try to copy and paste between A and A' Can not read memory occured. (In single…
1
vote
0 answers

Qt/C++ access mapped memory file from a different program

I'm looking to implement a way for a Qt application (can use any c++ methods or libraries) to access/find a mapped memory file created by a Matlab process. I've read several examples of how to do shared memory within a certain environment (i.e. 2…
willpower2727
  • 769
  • 2
  • 8
  • 23
1
vote
3 answers

QDatastream too slow?

I am trying to pass multiple images (actually a video) between two processes using QSharedmemory. Currently I am serializing a QVector of QImages and copying this to the memory. This works, but the serialization steps takes about 99% of the time.…
MaxR
  • 11
  • 3
1
2