Memory request for your application

I have a similar problem with this person . The main difference is that the application is NOT intended for a developer environment and so I need to know how to optimize the space used by the Sql server (maybe per machine based on specs).

I was intrigued by Ricardo C 's answer , specifically the following:

Extracted from SQL Server documentation:

Maximum server memory (in MB)

Specifies the maximum amount of memory that SQL Server can allocate when it starts up and during its startup. This configuration parameter can be set to if you know that there are multiple applications running at the same time as SQL Server and you want to ensure that these applications have sufficient memory to run. If these other applications, such as Web or mail servers, only request memory when needed, do not set the option because SQL Server will release memory to them as needed. However, applications often use whatever memory is available when they start and do not ask for more when needed... If an application that behaves in this manner is running on the same computer at the same time as SQL Server, install an option that ensures that the memory required by the application is not allocated by SQL Server.

My question is, how does the application request memory from the OS when needed? Is it something built in to compilation or something developer driven? The two main applications running on this machine are Sql Server and the (rather heavy) C # application I'm developing, and I'm pretty sure we haven't done anything specifically about OS memory request. Is there a correct / required way to do this?

0


source to share


3 answers


Some applications allocate a lot of memory at startup and then run their own memory management system on it. This can be useful for applications that have specific allocation patterns and believe they can do a better job than the more general memory manager provided by the runtime system.

Many games do this because they often have a very good idea of ​​what their memory usage will look like and are often heavily optimized. The default valve / system valve is versatile and not always fast enough. Doom has done this , and is pretty well known, and of course his code is available and widely discussed.



In "managed" languages ​​like C #, I think this is very rare and you have nothing to worry about.

+1


source


Every time you create a new object, you are asking the .NET garbage collector to provide you with memory. If the GC has insufficient memory on the managed heap then it will ask the OS for more. As stated in another question, although SQL Server is designed to reclaim memory, it doesn't seem like a good thing. There will be no hard and fast rules here, you will have to guess some settings for the SQL server and then check the performance. If you post some information about the server, the size of the database, how much memory your application requires, I'm sure people will be happy to give you some suggestions for initial setup. One caveat, however, I think that changing the memory limits requires a service restart.



0


source


This will depend on several things - in particular, the operating system and the language used.

For example, in macOS Classic it was not possible to allocate more memory after launch - we had to go and change how much memory was allocated using the Finder and then restart the application. Those were the bad old days.

Modern operating systems will allow running processes to request more memory - for example, in C, you can use alloc (), malloc (), realloc () or similarly request chunks of memory. In dynamic languages, you simply create objects or variables and more memory is allocated.

In java there is a limit on how much memory the JVM has access to - and that can only be changed by restarting the JVM and passing some arguments to it (sounds like the bad old days, doesn't it?).

In Objective-C, besides the malloc () family of functions, you can also create objects on the heap using

[object alloc]; 

      

which is most often viewed as

[[object alloc] init];

      

Note that this is slightly different from creating objects on the stack - if you are serious about programming, you will find the difference between the two might be useful :)

In conclusion - the programmer should ask the OS for more memory. This can be implicit (in dynamic languages, by creating objects, or by creating objects on the heap) or explicitly, for example, in C using alloc () / malloc () / etc.

0


source







All Articles