Re: Freeing memory to OS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thomas,

Depends on the operating system.

For example, on Amiga OS, the "get 50 bytes of memory from the OS" call
is...

   size_t size = 50;
   int memtype = MEMF_PUBLIC | MEMF_CLEAR;
   void* ptr = AllocMem(size, memtype),

...and the "release memory back to the OS" is...

   FreeMem(ptr, size)

Usually C malloc/free (and C++ new/delete) under the covers allocates a
larger extent from the OS, and manage that C memory heap (or C++ global
store) itself.

The SAS/C++ 6.56 compiler provides a lot of low level heap management
functions, but most compilers do not expose their heap management
mechanisms.

For Unix (Linux, Solaris, Darwin), you may want to refer to the man pages
for mmap, brk, sbrk, malloc, lf64, getrlimit, mprotect, munmap, lockf,
mlockall, msync, plock, sysconf, fnctl and shmat.

For Win32... *shrug*

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux