Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
Memory is usually created by allocators with a allocatorAlloc
method call. When Nothing
is used as the allocator, the default allocator will
be used.
New allocators can be registered with allocatorRegister
.
Allocators are identified by name and can be retrieved with
allocatorFind
. allocatorSetDefault
can be used to change the
default allocator.
New memory can be created with memoryNewWrapped
that wraps the memory
allocated elsewhere.
- newtype Allocator = Allocator (ManagedPtr Allocator)
- class GObject o => IsAllocator o
- toAllocator :: IsAllocator o => o -> IO Allocator
- noAllocator :: Maybe Allocator
- data AllocatorAllocMethodInfo
- allocatorAlloc :: (HasCallStack, MonadIO m, IsAllocator a) => a -> Word64 -> Maybe AllocationParams -> m Memory
- allocatorFind :: (HasCallStack, MonadIO m) => Maybe Text -> m (Maybe Allocator)
- data AllocatorFreeMethodInfo
- allocatorFree :: (HasCallStack, MonadIO m, IsAllocator a) => a -> Memory -> m ()
- allocatorRegister :: (HasCallStack, MonadIO m, IsAllocator a) => Text -> a -> m ()
- data AllocatorSetDefaultMethodInfo
- allocatorSetDefault :: (HasCallStack, MonadIO m, IsAllocator a) => a -> m ()
Exported types
GObject Allocator Source # | |
IsObject Allocator Source # | |
IsObject Allocator Source # | |
IsAllocator Allocator Source # | |
((~) * info (ResolveAllocatorMethod t Allocator), MethodInfo * info Allocator p) => IsLabel t (Allocator -> p) Source # | |
((~) * info (ResolveAllocatorMethod t Allocator), MethodInfo * info Allocator p) => IsLabelProxy t (Allocator -> p) Source # | |
HasAttributeList * Allocator Source # | |
type AttributeList Allocator Source # | |
type SignalList Allocator Source # | |
class GObject o => IsAllocator o Source #
toAllocator :: IsAllocator o => o -> IO Allocator Source #
Methods
alloc
data AllocatorAllocMethodInfo Source #
((~) * signature (Word64 -> Maybe AllocationParams -> m Memory), MonadIO m, IsAllocator a) => MethodInfo * AllocatorAllocMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsAllocator a) | |
=> a |
|
-> Word64 |
|
-> Maybe AllocationParams |
|
-> m Memory | Returns: a new |
Use allocator
to allocate a new memory block with memory that is at least
size
big.
The optional params
can specify the prefix and padding for the memory. If
Nothing
is passed, no flags, no extra prefix/padding and a default alignment is
used.
The prefix/padding will be filled with 0 if flags contains
GST_MEMORY_FLAG_ZERO_PREFIXED
and GST_MEMORY_FLAG_ZERO_PADDED
respectively.
When allocator
is Nothing
, the default allocator will be used.
The alignment in params
is given as a bitmask so that align
+ 1 equals
the amount of bytes to align to. For example, to align to 8 bytes,
use an alignment of 7.
find
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> m (Maybe Allocator) | Returns: a |
Find a previously registered allocator with name
. When name
is Nothing
, the
default allocator will be returned.
free
data AllocatorFreeMethodInfo Source #
((~) * signature (Memory -> m ()), MonadIO m, IsAllocator a) => MethodInfo * AllocatorFreeMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsAllocator a) | |
=> a |
|
-> Memory |
|
-> m () |
Free memory
that was previously allocated with allocatorAlloc
.
register
:: (HasCallStack, MonadIO m, IsAllocator a) | |
=> Text |
|
-> a |
|
-> m () |
Registers the memory allocator
with name
. This function takes ownership of
allocator
.
setDefault
data AllocatorSetDefaultMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsAllocator a) => MethodInfo * AllocatorSetDefaultMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsAllocator a) | |
=> a |
|
-> m () |
Set the default allocator. This function takes ownership of allocator
.