memory-mapped-files

Using a circular buffer on disk

僤鯓⒐⒋嵵緔 提交于 2019-12-08 05:19:11
问题 I was trying to create a memory-mapped circular buffer on disk using Boost, and I read this answer: https://stackoverflow.com/a/29265629/8474732 However, I have a hard time reading the circular buffer that was written. I tried to do a push_back on the "instance" variable, now the instance has size 1. Great. But how would I read the contents back? Or push_back additional elements at a later time? Creating another instance from the same allocator and mmf shows that the instance has size 0. I

ipc using Shared and as global MMF

…衆ロ難τιáo~ 提交于 2019-12-08 04:47:29
using MMF and C# I was creating a Shared Memory between 2 processes. my aim is to create it as a global say 4000 byte length and create partitions so Main proj is "MainProj" will start the MMF Named "$AppName$_sharedMMF" then "Debugger Proj" will Access that "$AppName$_sharedMMF" so the accessor positions are: MainProj->Debugger : readAddr = 0 , writeAddr = 250 Debbugger->MainProj : reafAddr = 250, writeAddr = 0 then the third executable in my solution will be //setter getter MainProj->AnotherExe : readAddr = 251 , writeAddr = 500 //setter getter EnotherExe->MainProj : reafAddr = 500,

c# MemoryMappedFile in .net 3.5

杀马特。学长 韩版系。学妹 提交于 2019-12-07 15:26:17
问题 I need to use MemoryMappedFile class in .net 3.5... is there any way to find the code of the classes used in .net 4.0 and create to use in .net 3.5? thanks in advance 回答1: If you need memory mapped files in .NET 3.5, you could also write your own wrapper around the respective Win32 methods from scratch. This might take a bit more effort, but it avoids any licensing issues. 回答2: .NET 4 uses a whole new CLR, and I wouldn't be at all surprised to find that enough had changed under the hood to

How can I extend the length of a memory-mapped file?

余生长醉 提交于 2019-12-07 09:01:06
问题 In Delphi 7, I open a file with CreateFileMapping then get a pointer by using MapViewOfFile. How can I expand the memory and add some characters to the memory and have it saved to that file? I have already opened the file with appropriate modes (fmOpenReadWrite, PAGE_READWRITE), and if I overwrite the characters, it gets saved to the file, but I need to add extra values in the middle of the file. 回答1: If the file mapping is backed by an actual file and not a block of memory, then you can

Access SQLite db from MMF

空扰寡人 提交于 2019-12-07 04:47:03
问题 I'm using System.Data.SQLite lib to access my SQLite database. I want to load the db file to memory and use MMF (Memory Mapped Files) to access the database. Is this possible using the default SQLite library? edit: Alternatives on how I can have an in-memory database are welcome. 回答1: no... You can: create an in-memory DB instance (specify in connection string Data Source=:memory: ) and load the contents from the DB file into that instance... when you change contents of the in-memory instance

Accessing the number of shared memory mapped file views (Windows)

╄→尐↘猪︶ㄣ 提交于 2019-12-07 02:18:03
问题 I am developing a multi-platform C++ application (mainly Windows and Linux), now I face the need to be able to limit the maximum number of instances of the application that may run at the same time (in the same machine). I have already a shared memory module that uses: Linux: System V shared memory (shmget(), shmat()...) Windows: Memory mapped files (CreateFileMapping(), OpenFileMapping(), MapViewOfFile(),...) In linux I can easily control the number of instances running with this kind of

Memory Mapped File and Win Service - Cannot find File Created By Server

为君一笑 提交于 2019-12-06 15:12:09
问题 I am trying to create a memory mapped file with a windows service so it can hold a lot of static data that other windows applications can use. My issue is that when I start the service - the service can read and write the memory mapped file easily. However, the windows apps cannot. They get a file not found error. Using the same class to read and write the memory mapped file, in two windows applications I have no issues. So, I am under the belief that the use of the memory mapped files is

Memory Mapped Files, Managed Mapped File and Offset Pointer

巧了我就是萌 提交于 2019-12-06 08:42:35
问题 I'm a little bit confused about the terminology of Boost Library (for windows). What I'm trying to do is simply; create a file on disk (a big file >50 GB) do some mapping for write and read operations seperately. For example first map 1 gb portion for writing & after that flush it to the hard drive take a new portion and so on, while the reader applications maps different parts of the file and do the reading stuff without changing anything (no edit). I'm reading the documentation of boost (1

Disadvantages of using memory mapped files

自古美人都是妖i 提交于 2019-12-06 05:35:39
问题 My web service writes several thousands of transactions per minute and we save them on the hd. I was testing different ways to save these files and I made some tests with standard IO and with MemoryMapped files. In my results, writing files (20 k text files) with MemoryMapped files is about 4x faster than standard IO and I was not able to find any disadvantages. As I have not so much experience with this technology, do you think I may face any problem using them or you don't see any

Java MemoryMapping big files

浪尽此生 提交于 2019-12-06 05:13:45
问题 The Java limitation of MappedByteBuffer to 2GIG make it tricky to use for mapping big files. The usual recommended approach is to use an array of MappedByteBuffer and index it through: long PAGE_SIZE = Integer.MAX_VALUE; MappedByteBuffer[] buffers; private int getPage(long offset) { return (int) (offset / PAGE_SIZE) } private int getIndex(long offset) { return (int) (offset % PAGE_SIZE); } public byte get(long offset) { return buffers[getPage(offset)].get(getIndex(offset)); } this can be a