Hi,
Thanks, both of you. Is the situation likely to be made worse or better
running unmanaged code from within a DLL under a .NET app? Who's in charge
of securing memory for the application in that case; does the DLL grab it
directly from the OS, or does the CLR stick its oar in as well / instead?
The problem I have is that it's likely there'll be an absolute minimum I can
get away with, and there'll be no way to test what that is since it'll be
different every time the app's run, let alone on different machines.
Thanks again,
Steve
> Have a look at
> GlobalMemoryStatusEx
[quoted text clipped - 11 lines]
> > > under Windows. My question is, is there any way to predict how much
> > > contiguous memory the OS will let you allocate at once?
[snip]
> > You're guaranteed to be able to allocate precisely 0 bytes contiguously,
> > AFIAK.
.......
> > Another thing you can do is to request a large block of memory very early
> in
[quoted text clipped - 12 lines]
> >
> > -cd
Carl Daniel [VC++ MVP] - 18 Mar 2004 16:39 GMT
Running under a .NET app is likely to make matters worse, I'd guess - simply
because there's significantly more code mapped into the address space for
the CLR and BCL assemblies.
-cd
> Hi,
>
[quoted text clipped - 48 lines]
>>>
>>> -cd
Jon - 18 Mar 2004 16:55 GMT
The other nice thing about CreateFileMapping is that you can use a real file for the backing store, so that the object size is
limited by the space on your hard drive not by the virtual memory size.
Managed code and Unmanaged code have different memory managers. The thing you want to watch for is you need to use IDispose on
managed objects that own large unmanaged objects.
> Hi,
>
[quoted text clipped - 51 lines]
> > >
> > > -cd
One way might be to use CreateFileMapping with a INVALID_HANDLE_VALUE for the hFile.
Then use MapViewOfFile to access the memory.
> Have a look at
> GlobalMemoryStatusEx
[quoted text clipped - 47 lines]
> >
> > -cd