C Language Memory Management
Return to C Language Pointers, C Language, Recursion, Pointers, Memory Management, C Language Bibliography
See:
- Snippet from Wikipedia: Pointer (computer programming)
In computer science, a pointer is an object in many programming languages that stores a memory address. This can be that of another value located in computer memory, or in some cases, that of memory-mapped computer hardware. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer. As an analogy, a page number in a book's index could be considered a pointer to the corresponding page; dereferencing such a pointer would be done by flipping to the page with the given page number and reading the text found on that page. The actual format and content of a pointer variable is dependent on the underlying computer architecture.
Using pointers significantly improves performance for repetitive operations, like traversing iterable data structures (e.g. strings, lookup tables, control tables, linked lists, and tree structures). In particular, it is often much cheaper in time and space to copy and dereference pointers than it is to copy and access the data to which the pointers point.
Pointers are also used to hold the addresses of entry points for called subroutines in procedural programming and for run-time linking to dynamic link libraries (DLLs). In object-oriented programming, pointers to functions are used for binding methods, often using virtual method tables.
A pointer is a simple, more concrete implementation of the more abstract reference data type. Several languages, especially low-level languages, support some type of pointer, although some have more restrictions on their use than others. While "pointer" has been used to refer to references in general, it more properly applies to data structures whose interface explicitly allows the pointer to be manipulated (arithmetically via pointer arithmetic) as a memory address, as opposed to a magic cookie or capability which does not allow such. Because pointers allow both protected and unprotected access to memory addresses, there are risks associated with using them, particularly in the latter case. Primitive pointers are often stored in a format similar to an integer; however, attempting to dereference or "look up" such a pointer whose value is not a valid memory address could cause a program to crash (or contain invalid data). To alleviate this potential problem, as a matter of type safety, pointers are considered a separate type parameterized by the type of data they point to, even if the underlying representation is an integer. Other measures may also be taken (such as validation and bounds checking), to verify that the pointer variable contains a value that is both a valid memory address and within the numerical range that the processor is capable of addressing.
C Language: C Fundamentals, C Inventor - C Language Designer: Dennis Ritchie in 1972; C Standards: ANSI X3J11 (ANSI C); ISO/IEC JTC 1 (Joint Technical Committee 1) / SC 22 (Subcommittee 22) / WG 14 (Working Group 14) (ISO C); C Keywords, C Pointers, C Data Structures - C Algorithms, C Syntax, C Memory Management, C Recursion, C on Android, C on Linux, C on macOS, C on Windows, C Installation, C Containerization, C Configuration, C Compiler, C IDEs (CLion), C Development Tools, C DevOps - C SRE, C Data Science - C DataOps, C Machine Learning, C Deep Learning, C Concurrency, C History, C Bibliography, Manning C Programming Series, C Glossary, C Topics, C Courses, C Standard Library, C Libraries, C Frameworks, C Research, C GitHub, Written in C, C Popularity, C Awesome List, C Versions. (navbar_c)
Memory management: Dynamic memory management, C language memory management, C dynamic memory allocation - C memory (malloc, realloc, calloc, C free, mimalloc), C++ memory (automatic storage duration, C++ auto, RAII), C# memory, Binary prefixes (kilo-mega-giga-tera-peta-exa-zetta-yotta), Manual memory management, Memory management (operating systems) (Linux memory - UNIX memory, Android memory, IBM mainframe memory, iOS memory, macOS memory, Windows memory), Memory: Memory address, Address space, Memory allocation - Memory allocator, Bash memory, Memory deallocation - Deallocation, Memory debugger (Memwatch, mtrace), Memory diffusion, Dynamic memory, Memory fence (Memory barrier), Memory fragmentation] - Fragmentation, Free list, Garbage collection - Garbage collector, Golang memory, Heap or Free store (Heap-based memory allocation), Stack (Call stack - Stack-based memory allocation - Stack (abstract data type) - LIFO (computing) - Stack frame - Stack unwinding), JVM memory (Java memory - Kotlin memory - Scala memory), Memory leak, Memory model, Memory paging, Out of memory, Page (computer memory), Pointers, C language pointers, Automatic pointer, Pointer swizzling, Memory pool, Memory protection, Physical memory, PowerShell memory, Python memory, RAM, Memory reference (Reference counting - Soft reference - Weak reference), Resource allocation (Resource Acquisition Is Initialization - RAII), Resource leak, Rust memory, Memory segmentation, Memory utilization, Shared memory, Static variable - Automatic variable, Virtual memory, Virtual address space. Memory management. (navbar_memory_management. See also navbar_memory or navbar_data_storage)
© 1994 - 2024 Cloud Monk Losang Jinpa or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.