472,989 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Memory Management

I have an .NET application that calls a DLL compiled with a fortran
compiler. Users are having a problem that the fortran DLL complains that is
unable to allocate memory when the arrays it is using are too big.

After reading around I decided that increasing the MaxWorkingSet for my
process may help.

However, the Fortran DLL fails (when it tries to allocate memory for an
array containing abotu 900Mb of data) before it gets to this MaxWorkingSet
value (about 1400Mb).

So, to try and get an understanding of this I tried to set the MaxWorkignSet
to about 500Mb. However, the fortran DLL is quite happily able to allocate
memory for an array that contains several 100Mb over this value. During
this, looking in the task manager I aslo see the peak memory usage has also
gone well over the MaxWorkingSet value.

Can someone explain to me what MaxWorkignSet really means? And is there
anyway I can get windows to let the fortran DLL allocate more memory?

Since someone is sure to ask, the fortran DLL contains a subroutine that
implements a mathematical model and I have now control over its desgn or how
much memory it tries to allocate.

TIA
Jul 21 '05 #1
10 2977
It sounds like you might have a memory leak in your application. If
you are in a looping routine that allocates memory, which a DLL call
could very well do, then make sure that you are deallocating the memory
and cleaning up appropriately because .Net can not automatically clean
up unmanaged resources.

Jul 21 '05 #2
> It sounds like you might have a memory leak in your application.

Thanks but this is not a memory leak. The DLL **needs** to use this amount
of memory and also quite happily cleans up after itself. What I need is an
understanding of what the MaxWorkingSet is/does and what changing its value
should do. The MSDN documentation is very thin on this.

Thanks
Jul 21 '05 #3
"elziko" <el****@yahoo.co.uk> wrote in message
news:uP**************@TK2MSFTNGP14.phx.gbl...
It sounds like you might have a memory leak in your application.
Thanks but this is not a memory leak. The DLL **needs** to use this amount
of memory and also quite happily cleans up after itself. What I need is an
understanding of what the MaxWorkingSet is/does and what changing its
value should do. The MSDN documentation is very thin on this.


The working set consists of the pages of RAM that are resident (i.e. not on
disk) for process. Setting the MaxWorkingSet constrains the process into
using a smaller amount of physical memory, which in your case will result in
more memory being paged to disk. However, it is best to think of this value
as a suggestion to the operating system rather than a constraint. When you
set the Max Working Set to a small value, the OS will indeed truncate the
working set and page the processes memory away to disk, but given no other
memory constraints, it will reallocate physical memory as the application
requires it.

As for memory limits:
- A Windows Application is constrained to 2GB (out of a 4GB space, 2GB is
for the system).
- .NET chews up a fair bit of this, and will constrain you to about
800MB-1.2GB total IIRC.

If you boot your OS in /3GB mode , and your program is linked with
LARGEADDRESSAWARE, Windows will only allocate 1GB to system, leaving 3GB for
your app, but .NET will still take a large chunk out of this. However you
must be sure that all your DLL's will be capable of handling large
addressing. If they're .NET they should be fine, but if that Fortran DLL is
not capable, you have a problem.

http://www.runuo.com/forum/showthread.php?t=38360
http://www.dotnet247.com/247referenc...55/276803.aspx
Thanks

Jul 21 '05 #4
> The working set consists of the pages of RAM that are resident (i.e. not
on disk) for process. Setting the MaxWorkingSet constrains the process
into using a smaller amount of physical memory, which in your case will
result in more memory being paged to disk. However, it is best to think of
this value as a suggestion to the operating system rather than a
constraint. When you set the Max Working Set to a small value, the OS will
indeed truncate the working set and page the processes memory away to
disk, but given no other memory constraints, it will reallocate physical
memory as the application requires it.


Thanks very much for that... and the links... our client is upgrading to 4Gb
so I'll be looking into this!
Jul 21 '05 #5

"elziko" <el****@yahoo.co.uk> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
The working set consists of the pages of RAM that are resident (i.e. not
on disk) for process. Setting the MaxWorkingSet constrains the process
into using a smaller amount of physical memory, which in your case will
result in more memory being paged to disk. However, it is best to think
of this value as a suggestion to the operating system rather than a
constraint. When you set the Max Working Set to a small value, the OS
will indeed truncate the working set and page the processes memory away
to disk, but given no other memory constraints, it will reallocate
physical memory as the application requires it.


Thanks very much for that... and the links... our client is upgrading to
4Gb so I'll be looking into this!


Be careful, there is no guarantee this will help you out.
The problem is that your array is that big you probably won't find a single
FREE contiguous array of that size in your process space due to
fragmentation.
Your best bet is to move to a 64bit OS like XP 64 or W2K3 64, running on
these gives you 4GB user space in 32bit mode.

Willy.

Jul 21 '05 #6
> Your best bet is to move to a 64bit OS like XP 64 or W2K3 64, running on
these gives you 4GB user space in 32bit mode.

Thanks for that. And out of interest, how much user space do you get in
WinXp64 in 64bit mode?
Jul 21 '05 #7

"elziko" <el****@yahoo.co.uk> wrote in message
news:eR**************@TK2MSFTNGP09.phx.gbl...
Your best bet is to move to a 64bit OS like XP 64 or W2K3 64, running on
these gives you 4GB user space in 32bit mode.

Thanks for that. And out of interest, how much user space do you get in
WinXp64 in 64bit mode?


X64 user mode address space = 8TB.

Willy.
Jul 21 '05 #8
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:e7**************@TK2MSFTNGP09.phx.gbl...
X64 user mode address space = 8TB.


Yeah, but .NET will need a fair whack of that for it's bookkeeping, so given
the lesson for 32bit, I'd assume that the amount available to your app will
be around 4TB.

Anyone know if LARGEADDRESSAWARE and a /7TB switch will be around for apps
that want to create a 6TB array? ;-)
Jul 21 '05 #9
> Anyone know if LARGEADDRESSAWARE and a /7TB switch will be around for apps
that want to create a 6TB array? ;-)


I'd imagine we'd be able to show-horn the model into 4TB. LOL I'm sure in
ten years time some body will come across this post in Google Groups and
think its not such a silly consideration after all!
Jul 21 '05 #10

"Sean Hederman" <em*******@codingsanity.blogspot.com> wrote in message
news:d6**********@ctb-nnrp2.saix.net...
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:e7**************@TK2MSFTNGP09.phx.gbl...
X64 user mode address space = 8TB.


Yeah, but .NET will need a fair whack of that for it's bookkeeping, so
given the lesson for 32bit, I'd assume that the amount available to your
app will be around 4TB.

Anyone know if LARGEADDRESSAWARE and a /7TB switch will be around for apps
that want to create a 6TB array? ;-)


Don't forget the OS will be written in managed code by that time which
brings us back at square one waiting for the first stable Beta of WinX128
;-)

Willy.
Jul 21 '05 #11

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

Similar topics

0
by: Richard Jones | last post by:
Garbage Collection & Memory Management Summer School 20-21 July 2004, Canterbury, UK The performance of today's memory-hungry applications depends on efficient dynamic memory management,...
2
by: DANIEL BEAULIEU J | last post by:
Basically i am a student taking an operating systems course which is c++ intensive. Familiar with Java, and so not so familiar with memory management. Looking for suggestions of exercises or web...
9
by: Mike P | last post by:
I know everything about reference counting and making sure you don't have large objects lying around. I have also profiled my app with multiple tools. I know about the fact GC collects memory but...
8
by: Chad | last post by:
hello, i am losing memory each time i make this call to a C++ dll (I make frequent calls). 'in VB.Net Declare Function grab Lib "grabber.dll" _ (ByRef lpBuf As Byte, ByVal lnum As Integer)...
1
by: trialproduct2004 | last post by:
Hi all, I am having slight confusion regarding memory management in .net. Say suppose i have two application one is in C# and other is in MFC(VC++). Both of this application are using lots...
0
by: erez_acount | last post by:
***************************************************************************** Call For Papers The 2006 International Symposium on Memory Management (ISMM'06) Co-located with PLDI 2006 ...
94
by: smnoff | last post by:
I have searched the internet for malloc and dynamic malloc; however, I still don't know or readily see what is general way to allocate memory to char * variable that I want to assign the substring...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
9
by: benoit808 | last post by:
I don't have a lot of experience with C++ so I apologize if this is a stupid question. I use Paul Nettle's memory manager (mmgr.cpp) which reports a memory leak but I don't think there's one. Here...
5
by: kumarmdb2 | last post by:
Hi guys, For last few days we are getting out of private memory error. We have a development environment. We tried to figure out the problem but we believe that it might be related to the OS...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.