# GstShmAllocator

This is a subclass of GstFdAllocator that implements the gst_allocator_alloc method using `memfd_create()` when available, POSIX `shm_open()` otherwise. Platforms not supporting any of those (Windows) will always return NULL.

Note that allocating new shared memories has a significant performance cost, it is thus recommended to keep a pool of pre-allocated GstMemory, using GstBufferPool. For that reason, this allocator has the GST_ALLOCATOR_FLAG_NO_COPY flag set.

## GstShmAllocator

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstAllocator
                    ╰──GstFdAllocator
                        ╰──GstShmAllocator

Private intance object for GstShmAllocator.

### Members

`parent_instance` (GstFdAllocator) –

Parent instance.

Since : 1.24

### Class structure

#### GstShmAllocatorClass

##### Fields

`parent_class` (GstFdAllocatorClass) –

Parent Class.

### GstAllocators.ShmAllocatorClass

##### Attributes

`parent_class` (GstAllocators.FdAllocatorClass) –

Parent Class.

### GstAllocators.ShmAllocatorClass

##### Attributes

`parent_class` (GstAllocators.FdAllocatorClass) –

Parent Class.

## GstAllocators.ShmAllocator

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Allocator
                    ╰──GstAllocators.FdAllocator
                        ╰──GstAllocators.ShmAllocator

Private intance object for GstAllocators.ShmAllocator.

### Members

`parent_instance` (GstAllocators.FdAllocator) –

Parent instance.

Since : 1.24

## GstAllocators.ShmAllocator

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Allocator
                    ╰──GstAllocators.FdAllocator
                        ╰──GstAllocators.ShmAllocator

Private intance object for GstAllocators.ShmAllocator.

### Members

`parent_instance` (GstAllocators.FdAllocator) –

Parent instance.

Since : 1.24

### Functions

#### gst_shm_allocator_get

    GstAllocator *
    gst_shm_allocator_get ()

Get the GstShmAllocator singleton previously registered with gst_shm_allocator_init_once.

Returns ( [transfer: full][nullable]) –

a GstAllocator or NULL if gst_shm_allocator_init_once has not been previously called.

Since : 1.24

#### GstAllocators.ShmAllocator.prototype.get

    function GstAllocators.ShmAllocator.prototype.get(): {
        // javascript wrapper for 'gst_shm_allocator_get'
    }

Get the GstAllocators.ShmAllocator singleton previously registered with GstAllocators.ShmAllocator.prototype.init_once.

Returns (Gst.Allocator) –

a Gst.Allocator or null if GstAllocators.ShmAllocator.prototype.init_once has not been previously called.

Since : 1.24

#### GstAllocators.ShmAllocator.get

    def GstAllocators.ShmAllocator.get ():
        #python wrapper for 'gst_shm_allocator_get'

Get the GstAllocators.ShmAllocator singleton previously registered with GstAllocators.ShmAllocator.init_once.

Returns (Gst.Allocator) –

a Gst.Allocator or None if GstAllocators.ShmAllocator.init_once has not been previously called.

Since : 1.24

#### gst_shm_allocator_init_once

    gst_shm_allocator_init_once ()

Register a GstShmAllocator using gst_allocator_register with the name GST_ALLOCATOR_SHM. This is no-op after the first call.

Since : 1.24

#### GstAllocators.ShmAllocator.prototype.init_once

    function GstAllocators.ShmAllocator.prototype.init_once(): {
        // javascript wrapper for 'gst_shm_allocator_init_once'
    }

Register a GstAllocators.ShmAllocator using Gst.Allocator.prototype.register with the name GstAllocators.ALLOCATOR_SHM. This is no-op after the first call.

Since : 1.24

#### GstAllocators.ShmAllocator.init_once

    def GstAllocators.ShmAllocator.init_once ():
        #python wrapper for 'gst_shm_allocator_init_once'

Register a GstAllocators.ShmAllocator using Gst.Allocator.register with the name GstAllocators.ALLOCATOR_SHM. This is no-op after the first call.

Since : 1.24

## Constants

### GST_ALLOCATOR_SHM

    #define GST_ALLOCATOR_SHM "shm"

Name of this allocator, to be used for example with gst_allocator_find and gst_memory_is_type.

Since : 1.24

### GstAllocators.ALLOCATOR_SHM

Name of this allocator, to be used for example with Gst.Allocator.prototype.find and Gst.Memory.prototype.is_type.

Since : 1.24

### GstAllocators.ALLOCATOR_SHM

Name of this allocator, to be used for example with Gst.Allocator.find and Gst.Memory.is_type.

Since : 1.24

### GST_TYPE_SHM_ALLOCATOR

    #define GST_TYPE_SHM_ALLOCATOR gst_shm_allocator_get_type ()

Macro that returns the GstShmAllocator type.

Since : 1.24

The results of the search are