| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Functions
wmem_allocator_block.h File Reference
`#include "wmem_core.h"`

Go to the source code of this file.

## Functions
void | wmem_block_allocator_init (wmem_allocator_t *allocator)
| Initialize a block-based memory allocator.
void | wmem_block_verify (wmem_allocator_t *allocator)
| Verifies internal consistency of a wmem block allocator.

## Detailed Description

Definitions for the Wireshark Memory Manager Large-Block Allocator Copyright 2012, Evan Huus eapac.nosp@m.he@g.nosp@m.mail..nosp@m.com

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

## Function Documentation

## ◆ wmem_block_allocator_init()

void wmem_block_allocator_init | ( | wmem_allocator_t * | allocator | ) |

Initialize a block-based memory allocator.

Sets up a `wmem_allocator_t` to use block-based memory management by assigning function pointers for allocation, reallocation, freeing, and cleanup operations. Internally, it creates a `wmem_block_allocator_t` structure to manage memory blocks and assigns it to the allocator's private data.

Parameters

  allocator | Pointer to the allocator structure to initialize.

Note
  After initialization, the allocator can be used for block-based memory operations. The allocator must not be NULL.

## ◆ wmem_block_verify()

void wmem_block_verify | ( | wmem_allocator_t * | allocator | ) |

Verifies internal consistency of a wmem block allocator.

This function performs integrity checks on the internal state of a block-based `wmem_allocator_t`. It is intended for use in unit tests or debugging scenarios to detect memory corruption, invalid pointers, or unexpected allocator behavior.

Parameters

  allocator | Pointer to the block allocator to verify.

Note
  This function is exposed only for testing purposes and should not be used in production code.