answersLogoWhite

0

Memory is allocated by malloc from the heap.... so max mem = size of heap that is free...

User Avatar

Wiki User

17y ago

What else can I help you with?

Continue Learning about Performing Arts

What operating systems are written in the C language?

They're not. Perhaps since the advent of UNIX, it has become obvious that writing software in higher level languages makes for less debugging and more reliable code, but originally OSs were written in the assembler of the machine they ran on. Believe it or not, most OS geeks think of "C" as a high level language. The fact that you can directly address all of memory and that it has a concept of interupt handling makes it an ideal candidate for portable OS code (consider that UNIX and later Linux now runs on virtually all hardware platforms). Java specifically prevents you from directly accessing random memory. You can only address memory that Java has allocated to you in the form of objects. You can imagine writing a function that allowed java to directly access that memory ... but what would that function be written in? Probably C. In fact, even version of the java engine I have seen was written in C or C++. Way back when, the majority of programmers out there had experience with assemblers and C was such an advance that there was no reason to turn back. By the way, the vast majority of OSs written in C still have a tiny bit of assembler associated with them associated with page handling and interupts. In short C is the highest low level language, where you define "low level language" as one that can directly access memory by address instead of as an object. Alternately, you can say that C is high level language that has the advantage of being able to directly access memory by ... etc. Problem is - the ability to talk about addresses instead of object handles makes it very easy to write bad code. And there is a LOT of bad C out there.


Which components of program state are shared across threads in a multi-threaded process?

a. Register values b. Heap memory c. Global variables d. Stack memory


What are the four steps to run a program on a completely dedicated machine?

a) Reserve Machine Time b) Manually Load Program Into Memory c) Load Starting Address And Begin Execution d) Monitor And Control Execution Of Program From console


Notes for Eastenders on the recorder?

The notes are C D E F G A F F E D C C C C E F G E D C


What notes is it to play eastenders tune on the recorder?

C D E F G A F F E D C C C C E F G E D But it is fast

Related Questions

What is the use of realloc in c program?

Increase or decrease the size of the allocated memory. (Note: functionality of malloc and free can be achieved with realloc, too.)


What does malloc return in C and C plus plus?

Address of the allocated area, or NULL.


What are new and delete operators in c plus plus?

New and Delete are the memory management operators in c++,like c language we use malloc() and calloc() functions to allocate memory and free() functiong to release the memory similarily we use new to allocate memory in C++ and Delete to release the allocated memory....


What is dynamic mamory?

Dynamic memory refers to memory that is allocated and deallocated during program execution, as opposed to static memory which is allocated at compile time. In C and C++, dynamic memory allocation is done using functions like malloc() and free(), allowing for flexibility in managing memory resources at runtime. However, improper use of dynamic memory can lead to memory leaks or segmentation faults.


How you use malloc function in c?

void* malloc (size_t bytes); This means that malloc takes an argument which is the size of memory to allocate and returns a pointer to that memory which has been allocated. If the return value is NULL, then the request could not be satisfied. Each call to malloc must be balanced with a corresponding call to free, to release the memory. int pa = NULL; pa = (int*) malloc (sizeof(int) * 1000); /* allocate 1000 ints */ if (pa == NULL) throw exception... ... use pa free (pa); pa = NULL;


Comparison of C' malloc and free functions with c new and delete operators?

Hi, The difference between new and malloc: 1.The New is a operator however malloc is a function 2.New returns the object type and there is no typecasting required. In malloc type casting should be done as it returns a void*. 3. The new operator can be overloaded however there is no over loading in C and hence Malloc can not be overloaded. 4. Operater New asks for the number of objects to be allocated however in malloc it will ask you for the number of bytes to be allocated. 5. The New operater will return you a exception of memory is not available however in malloc it will return u a NULL. 6. New is a concept for dynamically allocation in OOPS(C++) however malloc is used in C. The difference between the delete and free is as follows: 1. delete is a operator and can be overloaded however free is a function and can not be overloaded. With Regards, Shashiraja Shastry


What is malloc function in C?

The malloc function is a function used in C/C++ and various other high-level programming languges to add memory to the heap, it is essentially a pointer int* X = malloc(sizeof(int)); Where the parameter to malloc is the number of bytes you want to make room for. Because we are using an integral variable we want to make as much room as an integer takes.


Where the heap memory is allocated in c?

Main Memory (RAM).


Static and dynamic memory allocation in c plus plus?

dynamic memory allocation is that type of memory which create to allocate the memory on running time or at compile time by the function of malloc , calloc , realloc and free. dynamic memory allocation is give the best utilization of memory which gives the sufficient use of memory.


What is malloc fail?

MALLOC is an C Subroutine that requests the allocation memory. When this call fails, the most common reason is that you're out of memory; it's all been allocated. Unless you're programming this application, this is one of those problems you likely can't fix. Consider powering the system down, unplugging it, waiting 5 minutes and trying again.


What is the difference between delete and free?

Are you talking about freeing dynamically allocated memory in C/C++? free() is a function that you use to release dynamically (i.e. at run-time) created memory in C, using malloc() or alloc() or such other functions. In the same way, delete() is a function that is used in C++ to release memory created at run-time using the function new(). (Note that you can still use malloc and other C functions in your C++ code, but it is not considered a good programming habit. Moreover, new() is easier to use and more flexible, once you get the hang of it. If this is not what you had in mind, then I do not know if this will be of any help to you. addition: -new is constructor of which delete is destructor so use in pairs always.. similarly use malloc with free.. extra note: - no type cast required for new , whereas malloc, free may require it. - new returns exception whereas malloc returns NULL when memory issue.


What is really meant by malloc and where you will use this malloc?

malloc is a function of the standard c library (stdlib) and it is abbreviation for memory allocate. What this function does is allocates memory in the RAM of computer to store variable data in it. You will use it whenever you need a place to store you temporary data such as an array or structure. To use malloc all you have to do is call malloc and tell it the size of the memory you want. It will then return a pointer to that memory. persumabely if it fails it returns NULL.