c - how memory allocation works at extremes? -
i quite confused how memory allocation (malloc/calloc) works in linux/c. suppose, have machine 16gb ram , run program root. 64-bit machine, 16gb can addressed single segment. can allocate of (less amount os of course) single malloc call? many malloc calls?
how relates "heap memory" , "virtual memory"? if allocate small memory chunk, , happens in heap memory, resize (enlarge) chunk, happens when approach stack area?
do have fiddle setrlimit rlimit_as if want (almost) ram assigned single process, thought it's running root?
a 64-bit process can allocate of memory. doesn't need root, unless system has defined ulimit
setting non-root users. try ulimit -v
see if limit set.
under linux default settings process can ask amount of memory , granted. memory assigned used, , come physical ram or disk swap needed.
a memory allocation resize done in c library allocating new, larger size , copying old data new allocation. not done expanding existing allocation. memory allocations chosen not conflict other allocations such program stack.
Comments
Post a Comment