JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Programming Interfaces Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information


1.  Memory and CPU Management

Memory Management Interfaces

Creating and Using Mappings

Removing Mappings

Cache Control

Using mincore

Using mlock and munlock

Using mlockall and munlockall

Using msync

Library-Level Dynamic Memory

Dynamic Memory Allocation

Dynamic Memory Debugging

Other Memory Control Interfaces

Using sysconf

Using mprotect

Using brk and sbrk

CPU Performance Counters

API Additions to libcpc

Initialization Interfaces

Hardware Query Interfaces

Configuration Interfaces



Buffer Operations

Activation Interfaces

Error Handling Interfaces

2.  Session Description Protocol API

3.  Process Scheduler

4.  Locality Group APIs

5.  Input/Output Interfaces

6.  Interprocess Communication

7.  Socket Interfaces

8.  Programming With XTI and TLI

9.  Packet Filtering Hooks

10.  Transport Selection and Name-to-Address Mapping

11.  Real-time Programming and Administration

12.  The Oracle Solaris ABI and ABI Tools

A.  UNIX Domain Sockets


Library-Level Dynamic Memory

Library-level dynamic memory allocation provides an easy-to-use interface to dynamic memory allocation.

Dynamic Memory Allocation

The most often used interfaces are:

Other dynamic memory allocation interfaces are memalign(3C), valloc(3C), and realloc(3C)

Dynamic Memory Debugging

The Oracle Solaris Studio software included tools that are useful in finding and eliminating errors in dynamic memory use.

dbx is an interactive, source-level, command-line debugging tool. You can use it to run a program in a controlled manner and to inspect the state of a stopped program. dbx gives you complete control of the dynamic execution of a program, including collecting performance and memory usage data, monitoring memory access, and detecting memory leaks. dbxtool provides a graphical user interface for dbx. See Oracle Solaris Studio 12.3: Debugging a Program With dbx for detailed information.

The Run Time Checking (RTC) tool in the Oracle Solaris Studio software lets you automatically detect runtime errors, such as memory access errors and memory leak, in a native code application during the development phase. It also lets you monitor memory usage. You cannot use runtime checking on Java code. See Chapter 9, Using Runtime Checking, in Oracle Solaris Studio 12.3: Debugging a Program With dbx for details on using the RTC facility.

You can also use the advanced development tool Memory Error Discovery Tool (Discover) for detecting memory access error. See the Oracle Solaris Studio 12.3 Discover and Uncover User's Guide for detailed information.

Oracle Solaris Studio is available on as a package to download and install on the Oracle Solaris 11 OS. For more information, see the Oracle Solaris Studio website.

Other Memory Control Interfaces

This section discusses additional memory control interfaces.

Using sysconf

sysconf(3C) returns system dependent sizes of memory pages and applications should use getpagesizes(3C) to find out which memory pages are available to a running process. For portability, applications should not embed any constants that specify the size of a page. Note that varying page sizes are not unusual, even among implementations of the same instruction set.

Using mprotect

mprotect(2) assigns the specified protection to all pages in the specified address range. The protection cannot exceed the permissions that are allowed on the underlying object.

Using brk and sbrk

A break is the greatest valid data address in the process image that is not in the stack. When a program starts executing, the break value is normally set by execve(2) to the greatest address defined by the program and its data storage.

Use brk(2) to set the break to a greater address. You can also use sbrk(2) to add an increment of storage to the data segment of a process. You can get the maximum possible size of the data segment by a call to getrlimit(2).

brk(caddr_t addr);

sbrk(intptr_t incr);

brk identifies the lowest data segment location not used by the caller as addr. This location is rounded up to the next multiple of the system page size.

sbrk, the alternate interface, adds incr bytes to the caller data space and returns a pointer to the start of the new data area.