473,396 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Memory mapping


Does .NET provide an equivalent of memory mapped files from Linux?

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u
Jun 27 '08 #1
2 1882
On May 30, 9:00 am, Jon Harrop <j...@ffconsultancy.comwrote:
Does .NET provide an equivalent of memory mapped files from Linux?
Not as far as I'm aware. A quick search found this library, however:
http://www.winterdom.com/dev/dotnet/index.html

(Windows itself supports memory mapped files, so it's just a case of
wrapping the calls.)

I wouldn't be surprised to find this had crept into later versions
of .NET without me noticing, mind you.

Jon
Jun 27 '08 #2
Jon Harrop wrote:
Does .NET provide an equivalent of memory mapped files from Linux?
Win32 API does.

I once used it Delphi-C#.

Below is a snippet of declarations.

Arne

================================================== ==========

const int PAGE_READONLY = 0x0002;
const int PAGE_READWRITE = 0x0004;
const int PAGE_EXECUTE = 0x0010;
const int PAGE_EXECUTE_READ = 0x0020;
const int PAGE_EXECUTE_READWRITE = 0x0040;
const int PAGE_GUARD = 0x0100;
const int PAGE_NOACCESS = 0x0001;
const int PAGE_NOCACHE = 0x0200;
const int FILE_MAP_COPY = 0x0001;
const int FILE_MAP_WRITE = 0x0002;
const int FILE_MAP_READ = 0x0004;
const int FILE_MAP_ALL_ACCESS = 0x001F;

[StructLayout( LayoutKind.Sequential )]
class SECURITY_ATTRIBUTES
{
//int nLength;
//int lpSecurityDescriptor;
//int bInheritHandle;
}

[DllImport("kernel32.dll")]
static extern int CreateFileMappingA ( uint hFile,
SECURITY_ATTRIBUTES
lpFileMappigAttributes,
int flProtect,
int dwMaximumSizeHigh,
int dwMaximumSizeLow,
string lpName);

[DllImport("kernel32.dll")]
static extern IntPtr MapViewOfFile ( int hFileMappingObject,
int dwDesiredAccess,
int dwFileOffsetHigh,
int dwFileOffsetLow,
int dwNumberOfBytesToMap);

[DllImport("kernel32.dll")]
static extern int UnmapViewOfFile (IntPtr lpBaseAddress);

[DllImport("kernel32.dll")]
static extern int CloseHandle ( int hObject);
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Srijit Kumar Bhadra | last post by:
Hello, Here are code snippets to create and access shared memory in Python with and without ctypes module. With regards, Srijit Filename : SharedMemCreate.py import msvcrt, mmap
9
by: Jimmy Cerra | last post by:
I am a little confused how the memory for objects is allocated in JavaScript. David Flanagan, in "JavaScript: The Definitive Guide," states that each property of a class takes up memory space when...
19
by: Holger Hasselbach | last post by:
- The value of the object allocated by the malloc function is used (7.20.3.3). - The value of any bytes in a new object allocated by the realloc function beyond the size of the old object are used...
5
by: Mike S | last post by:
I'm working on a .NET application that was under development by a previous developer, who is no longer working with the company. The program basically extracts records from a source database and...
5
by: cikkamikka | last post by:
Hi friends, Sorry for such basic question. but I wanted to know where does new operator or malloc operator allocate memory? in actualy physical Main memory or virtual memory?
5
by: Tim | last post by:
Hello Everyone, I am getting shared memory in python using the following. szName = c_char_p(name) hMapObject = windll.kernel32.CreateFileMappingA(INVALID_HANDLE_VALUE, None, PAGE_READONLY, 0,...
3
by: pratap | last post by:
consider int p=10; int *q=&p; now my question is how does the compiler (or any type of mechanism) bind q and p .i.e. memory location of a variable p is bound in a variable q. How does this...
1
by: r3d dra6on | last post by:
The following bit of code is only the memory mapping part, but I am unsure about the output area of the code. I know how to bring in an input file, but I am unsure if this code sends out an output...
0
by: Hypnotik | last post by:
My program is to simulate cache memory. I read in the info from 2 external files, 1) access 2) data in memory. When I read the information in I display the info...and it is all correct. However...
3
by: Tom | last post by:
I don't want to re-invent the wheel and am looking for a simple implementation of a text viewer or RichTextBox in read only mode that allows rapid file positioning within large data files without...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.