GraphicsMagick

- Home
- Project
- Download
- Install
- Source
- News
- Utilities
- Programming
- Reference

# resource

## Set resource consumption limits (e.g. memory)

Contents

- AcquireMagickResource
- GetMagickResource
- GetMagickResourceLimit
- LiberateMagickResource
- ListMagickResourceInfo
- SetMagickResourceLimit

# AcquireMagickResource

## Synopsis

    MagickPassFail AcquireMagickResource( const ResourceType type, const magick_int64_t size );

## Description

AcquireMagickResource() acquires resources of the specified type. True is returned if the specified resource is available otherwise False.

The format of the AcquireMagickResource() method is:

    MagickPassFail AcquireMagickResource( const ResourceType type, const magick_int64_t size );

type:
  The type of resource.
size:
  The number of bytes needed from for this resource.

# GetMagickResource

## Synopsis

    magick_uint64_t GetMagickResource( const ResourceType type );

## Description

GetMagickResource() returns the current consumption level for the specified resource type.

The format of the GetMagickResource() method is:

    magick_uint64_t GetMagickResource( const ResourceType type );

A description of each parameter follows:

type:
  The type of resource.

# GetMagickResourceLimit

## Synopsis

    magick_int64_t GetMagickResourceLimit( const ResourceType type );

## Description

GetMagickResourceLimit() returns the current maximum limit for the specified resource type. Returns a maximum 64-bit integer value if the resource has not been limited.

The format of the GetMagickResourceLimit() method is:

    magick_int64_t GetMagickResourceLimit( const ResourceType type );

A description of each parameter follows:

type:
  The type of resource.

# LiberateMagickResource

## Synopsis

    void LiberateMagickResource( const ResourceType type, const magick_int64_t size );

## Description

LiberateMagickResource() liberates resources of the specified type.

The format of the LiberateMagickResource() method is:

    void LiberateMagickResource( const ResourceType type, const magick_int64_t size );

type:
  The type of resource.
size:
  The size of the resource.

# ListMagickResourceInfo

## Synopsis

    unsigned int ListMagickResourceInfo( FILE *file, ExceptionInfo *exception );

## Description

Method ListMagickResourceInfo lists the resource info to a file.

The format of the ListMagickResourceInfo method is:

    unsigned int ListMagickResourceInfo( FILE *file, ExceptionInfo *exception );

A description of each parameter follows.

file:
  An pointer to a FILE.
exception:
  Return any errors or warnings in this structure.

# SetMagickResourceLimit

## Synopsis

    void SetMagickResourceLimit( const ResourceType type, const unsigned long limit );

## Description

SetMagickResourceLimit() sets the limit for a particular resource. The units for resource types are as follows:

DiskResource -- Bytes FileResource -- Open files MapResource -- Bytes MemoryResource -- Bytes PixelsResource -- Pixels ThreadsResource -- Threads WidthResource -- Pixels HeightResource -- Pixels

The format of the SetMagickResourceLimit() method is:

    void SetMagickResourceLimit( const ResourceType type, const unsigned long limit );

type:
  The type of resource.
limit:
  The maximum limit for the resource.

Copyright © GraphicsMagick Group 2002 - 2021