Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
dynamically allocated memory is the memory allocated in heap at run-time.
see http://en.wikipedia.org/wiki/Heap_(programming)
In computer science, dynamic memory allocation is the allocation of memory storage for use in a computer program during the runtime of that program. It is a way of distributing ownership of limited memory resources among many pieces of data and code. A dynamically allocated object remains allocated until it is deallocated explicitly, either by the programmer or by a garbage collector; this is notably different from automatic and static memory allocation. It is said that such an object has dynamic lifetime.
The Need:
-------------
It is desirable to dynamically allocate space for variables at runtime. It is wasteful when dealing with array type structures to allocate so much space when declared, eg,
struct client clients[100];
This practice may lead to memory contention or programs crashing. A far better way is to allocate space to clients when needed.
The C programming language allows users to dynamically allocate and deallocate memory when required. The functions that accomplish this are calloc(), which allocates memory to a variable, sizeof, which determines how much memory a specified variable occupies, and free(), which deallocates the memory assigned to a variable back to the system.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.