---
title: OSSymbol
framework: kernel
role: symbol
role_heading: Class
path: kernel/ossymbol
---

# OSSymbol

OSSymbol wraps a C string in a unique C++ object for use as keys in Libkern collections.

## Declaration

```occ
class OSSymbol : OSString
```

## Overview

Overview OSSymbol is a container class for managing uniqued strings, for example, those used as dictionary keys. Its static instance-creation functions check for an existing instance of OSSymbol with the requested C string value before creating a new object. If an instance already exists in the pool of unique symbols, its reference count is incremented and the existing instance is returned. While OSSymbol provides for uniquing of a given string value, it makes no effort to enforce immutability of that value. Altering the contents of an OSSymbol should be avoided. Use Restrictions With very few exceptions in the I/O Kit, all Libkern-based C++ classes, functions, and macros are unsafe to use in a primary interrupt context. Consult the I/O Kit documentation related to primary interrupts for more information. OSSymbol provides no concurrency protection; it's up to the usage context to provide any protection necessary. Some portions of the I/O Kit, such as IORegistryEntry, handle synchronization via defined member functions for setting properties.

## Topics

### Miscellaneous

- [free](kernel/ossymbol/1808021-free.md)
- [initWithCString](kernel/ossymbol/1808026-initwithcstring.md)
- [initWithCStringNoCopy](kernel/ossymbol/1808036-initwithcstringnocopy.md)
- [initWithString](kernel/ossymbol/1808054-initwithstring.md)
- [isEqualTo](kernel/ossymbol/1808078-isequalto.md)
- [isEqualTo(const char *)](kernel/ossymbol/1808093-isequalto.md)
- [isEqualTo(const OSSymbol *)](kernel/ossymbol/1808114-isequalto.md)
- [taggedRelease(const void *)](kernel/ossymbol/1808137-taggedrelease.md)
- [taggedRelease(const void *, const int)](kernel/ossymbol/1808154-taggedrelease.md)
- [withCString](kernel/ossymbol/1808171-withcstring.md)
- [withCStringNoCopy](kernel/ossymbol/1808179-withcstringnocopy.md)
- [withString](kernel/ossymbol/1808192-withstring.md)

### Instance Methods

- [free](kernel/ossymbol/1399376-free.md)
- [getMetaClass](kernel/ossymbol/1399366-getmetaclass.md)
- [initWithCString](kernel/ossymbol/1399374-initwithcstring.md)
- [initWithCStringNoCopy](kernel/ossymbol/1399383-initwithcstringnocopy.md)
- [initWithString](kernel/ossymbol/1399368-initwithstring.md)
- [isEqualTo](kernel/ossymbol/1399364-isequalto.md)
- [isEqualTo](kernel/ossymbol/3516844-isequalto.md)
- [isEqualTo](kernel/ossymbol/3516845-isequalto.md)
- [taggedRelease](kernel/ossymbol/1399380-taggedrelease.md)
- [taggedRelease](kernel/ossymbol/3516846-taggedrelease.md)
- [taggedRetain](kernel/ossymbol/4143382-taggedretain.md)

### Type Methods

- [existingSymbolForCString](kernel/ossymbol/3143271-existingsymbolforcstring.md)
- [existingSymbolForString](kernel/ossymbol/3143272-existingsymbolforstring.md)
- [initialize](kernel/ossymbol/1399378-initialize.md)
- [withCString](kernel/ossymbol/1399370-withcstring.md)
- [withCStringNoCopy](kernel/ossymbol/1399385-withcstringnocopy.md)
- [withString](kernel/ossymbol/1399372-withstring.md)

## Relationships

### Inherits From

- [OSString](kernel/osstring.md)

## See Also

### Base Types

- [OSObject](kernel/osobject.md)
- [OSMetaClass](kernel/osmetaclass.md)
- [OSMetaClassBase](kernel/osmetaclassbase.md)
- [OSObjectPtr](kernel/osobjectptr.md)
- [OSObjectRef](kernel/osobjectref.md)
- [Additional Types](kernel/libkern/data_types/additional_types.md)
