Training
×

Dynamic Memory

There are two ways of allocating dynamic memory, each intended for a particular usage:
  • For dynamic memory that will be used only within the process, the page-alignment may cause a lot of wasting; in that case the standard C functions malloc and free (or the C++ features new and delete) along with native INtime functions may be a more efficient alternative.
  • If you want to pass memory to a thread in another (RT or Windows) process, you should allocate shareable memory; which is always aligned on 4K boundaries with guard pages on each end. A memory a handle can be requested for sharable memory, which can then be passed on to another thread, and mapped into its own address space.