Click here to Skip to main content
15,891,375 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
Stuart Dootson19-Sep-19 3:36
professionalStuart Dootson19-Sep-19 3:36 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 3:37
mvahoney the codewitch19-Sep-19 3:37 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
Stuart Dootson19-Sep-19 3:47
professionalStuart Dootson19-Sep-19 3:47 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 3:50
mvahoney the codewitch19-Sep-19 3:50 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
Steve Naidamast19-Sep-19 5:11
professionalSteve Naidamast19-Sep-19 5:11 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 5:28
mvahoney the codewitch19-Sep-19 5:28 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 6:50
zezba900019-Sep-19 6:50 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 6:53
mvahoney the codewitch19-Sep-19 6:53 
Nope, because you can't pin an object to a specific address in memory.

Ergo I can't back a .NET instance with a memory mapped file.

Memory mapped files work by mapping a portion of the process address space to your application.

So you can read and write the file doing pointer ops.

However, in .NET you can only get pointers to the GC heap by pinning objects.

So I cannot do

C#
var arr = new int[100000000];// backed by memory mapped file


in any variation. Even if I were to pin the array to get the pointer, the pointer wouldn't be part of that mapped address space.

At best, I have to *copy* the entire object into that mapped region, which absolutely defeats the whole point of why I'd use mem mapped I/O here in the first place.

There's a half measure using Span, but it only works in Standard and Core, not the DNF
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 7:06
zezba900019-Sep-19 7:06 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 7:09
mvahoney the codewitch19-Sep-19 7:09 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 7:17
zezba900019-Sep-19 7:17 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 7:17
mvahoney the codewitch19-Sep-19 7:17 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 7:20
zezba900019-Sep-19 7:20 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 7:21
mvahoney the codewitch19-Sep-19 7:21 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 7:26
zezba900019-Sep-19 7:26 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 7:28
mvahoney the codewitch19-Sep-19 7:28 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 7:35
zezba900019-Sep-19 7:35 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 7:37
mvahoney the codewitch19-Sep-19 7:37 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 7:43
zezba900019-Sep-19 7:43 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 7:51
mvahoney the codewitch19-Sep-19 7:51 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 8:01
zezba900019-Sep-19 8:01 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 8:28
mvahoney the codewitch19-Sep-19 8:28 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 8:37
zezba900019-Sep-19 8:37 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
honey the codewitch19-Sep-19 8:41
mvahoney the codewitch19-Sep-19 8:41 
GeneralRe: I thought .NET was supposed to make things easier, if anything, than unmanaged code. Pin
zezba900019-Sep-19 9:05
zezba900019-Sep-19 9:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.