[Qt-interest] qsharedmemory after crash.

David Forstenlechner dforsten at newtek.com
Sat Jul 30 00:58:43 CEST 2011


That would be the logical thing to do,
but QSharedMemory does not seem to provide the functions
to allow the deletion of an existing shared memory segment.

- DavidF

Am 29.07.2011 18:53, schrieb Tom Green:
>
> The simple answer is that when you call QSharedMemory::create, if it returns false, delete the old segment, and then re-create it.
>
> Tom
>
> ----- Original Message -----
> From: "David Forstenlechner" <dforsten at newtek.com>
> To: qt-interest at trolltech.com
> Sent: Friday, July 29, 2011 4:31:25 AM
> Subject: Re: [Qt-interest] qsharedmemory after crash.
>
> I am running into the same problem,
> there does not seem to be a way to destroy memory allocated by
> QSharedMemory after
> an unclean shutdown of a process attached to it, making this nice cross
> platform abstraction
> dubious in production code, you have to descend to platform specific
> APIs in any case.
> Its good for quick prototyping though.
>
> A "destroy()" function like in QtSharedMemory would be very helpful.
>
> - DavidF
>
> Am 05.09.2008 18:44, schrieb bkn at ithryn.net:
>> Hi All,
>> I have found qsharedmemory to be very useful. Sadly, i'm not a perfect
>> programmer and my application will crash. This leaves memory segments
>> created by qsharedmemory to live beyond the application crash. The next
>> time i run the application it will attach to the previously allocated
>> memory segment from before the crash. This behavior is described in the Qt
>> Documentation. 
>>
>> Is there a way i can tell Qt (or linux) to release that memory segment so
>> when i run my application after a crash it will attach to a clean and
>> perhaps differently sized memory segment? Otherwise it seems i have to quit
>> KDE or even restart the computer to start with fresh memory segments. I
>> suppose one way to do this is to create a qsharedmemory instance with a
>> unique name every time the application is run, but i was hoping there is a
>> better way since i use several instances of qsharedmemory segments.
>>
>> Thanks for you help, cheers, 
>>  - b
>>
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request at trolltech.com with "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>>
>>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>


-- 
*3D Software Architect*
LightWave10


    count on it

________________________

www.newtek.com/lightwave <http://www.newtek.com/lightwave>
*Email:* dforsten at newtek.com <mailto:dforsten at newtek.com>
*Mobile:* ++43 676 6293435
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110730/3963abfd/attachment.html 


More information about the Qt-interest-old mailing list