ajmem.c


Function ajMemAlloc

Allocates memory using malloc, and fails with an error message if unsuccessful.

Prototype

void* ajMemAlloc (
      size_t nbytes,
      const char* file,
      ajint line,
      AjBool nofail
);

TypeNameRead/WriteDescription
size_tnbytesInputNumber of bytes required
const char*fileInputSource file name, generated by a macro.
ajintlineInputSource line number, generated by a macro.
AjBoolnofailInputIf true, return with a NULL pointer when unable to allocate.
void* RETURNSuccessfully allocated memory, or NULL on failure. Normal behaviour is to raise an exception and fail, or if running with Java, to print to standard error and exit.

From EMBOSS 1.0.0


Function ajMemCalloc

Allocates memory using calloc for an array of elements, and fails with an error message if unsuccessful.

Prototype

void* ajMemCalloc (
      size_t count,
      size_t nbytes,
      const char* file,
      ajint line,
      AjBool nofail
);

TypeNameRead/WriteDescription
size_tcountInputNumber of elements required
size_tnbytesInputNumber of bytes required per element
const char*fileInputSource file name, generated by a macro.
ajintlineInputSource line number, generated by a macro.
AjBoolnofailInputIf true, return with a NULL pointer when unable to allocate.
void* RETURNSuccessfully allocated memory, or NULL on failure. Normal behaviour is to raise an exception and fail, or if running with Java, to print to standard error and exit.

From EMBOSS 1.0.0


Function ajMemCallocZero

Allocates memory using calloc for an array of elements, and fails with an error message if unsuccessful.

Prototype

void* ajMemCallocZero (
      size_t count,
      size_t nbytes,
      const char* file,
      ajint line,
      AjBool nofail
);

TypeNameRead/WriteDescription
size_tcountInputNumber of elements required
size_tnbytesInputNumber of bytes required
const char*fileInputSource file name, generated by a macro.
ajintlineInputSource line number, generated by a macro.
AjBoolnofailInputIf true, return with a NULL pointer when unable to allocate.
void* RETURNSuccessfully allocated memory, or NULL on failure. Normal behaviour is to raise an exception and fail, or if running with Java, to print to standard error and exit.

From EMBOSS 6.0.0


Function ajMemSetZero

Zeroes memory for an array of elements,

Prototype

void ajMemSetZero (
      void* ptr,
      size_t count,
      size_t nbytes
);

TypeNameRead/WriteDescription
void*ptrModifyPointer to memory previously allocated with 'malloc'
size_tcountInputNumber of elements required
size_tnbytesInputNumber of bytes required
void RETURN

From EMBOSS 6.0.0


Function ajMemFree

Frees memory using 'free' and zeroes the pointer. Ignores NULL (uninitialised) pointers.

Prototype

void ajMemFree (
      void** ptr
);

From EMBOSS 1.0.0

Function ajMemResize

Resizes previously allocated memory, and ensures data is copied to the new location if it is moved.

Prototype

void* ajMemResize (
      void* ptr,
      size_t nbytes,
      const char* file,
      ajint line,
      AjBool nofail
);
TypeNameRead/WriteDescription
void**ptrModifyPointer to memory previously allocated with 'malloc'
void*ptrModifyPointer to memory previously allocated with 'malloc'
size_tnbytesInputNumber of bytes required
const char*fileInputSource file name, generated by a macro.
ajintlineInputSource line number, generated by a macro.
AjBoolnofailInputIf true, return with a NULL pointer when unable to allocate.
void* RETURNSuccessfully reallocated memory, or NULL on failure. Normal behaviour is to raise an exception and fail, or if running with Java, to print to standard error and exit.

From EMBOSS 1.0.0


Function ajMemResizeZero

Resizes previously allocated memory, and ensures data is copied to the new location if it is moved.

Prototype

void* ajMemResizeZero (
      void* ptr,
      size_t oldbytes,
      size_t nbytes,
      const char* file,
      ajint line,
      AjBool nofail
);

TypeNameRead/WriteDescription
void*ptrModifyPointer to memory previously allocated with 'malloc'
size_toldbytesInputNumber of bytes required
size_tnbytesInputNumber of bytes required
const char*fileInputSource file name, generated by a macro.
ajintlineInputSource line number, generated by a macro.
AjBoolnofailInputIf true, return with a NULL pointer when unable to allocate.
void* RETURNSuccessfully reallocated memory, or NULL on failure. Normal behaviour is to raise an exception and fail, or if running with Java, to print to standard error and exit.

From EMBOSS 6.0.0


Function ajMemArrB

Creates an AjBool array. Use AJFREE to free the memory when no longer needed.

Prototype

ajint* ajMemArrB (
      size_t size
);

TypeNameRead/WriteDescription
size_tsizeInputNumber of array elements.
ajint* RETURNNewly allocated array.

From EMBOSS 1.0.0


Function ajMemArrI

Creates an integer array. Use AJFREE to free the memory when no longer needed.

Prototype

ajint* ajMemArrI (
      size_t size
);

TypeNameRead/WriteDescription
size_tsizeInputNumber of array elements.
ajint* RETURNNewly allocated array.

From EMBOSS 1.0.0


Function ajMemArrF

Creates a float array. Use AJFREE to free the memory when no longer needed.

Prototype

float* ajMemArrF (
      size_t size
);

TypeNameRead/WriteDescription
size_tsizeInputNumber of array elements.
float* RETURNNewly allocated array.

From EMBOSS 1.0.0


Function ajMemStat

Prints a summary of memory usage with debug calls

Prototype

void ajMemStat (
      const char* title
);

TypeNameRead/WriteDescription
const char*titleInputTitle for this summary
void RETURN

From EMBOSS 1.0.0


Function ajMemExit

Prints a summary of memory usage with debug calls

Prototype

void ajMemExit (
      void
);

TypeNameRead/WriteDescription
void RETURN

From EMBOSS 1.0.0


Function ajMemCheck

Prints a message appropriate to the memcheck status

Prototype

void ajMemCheck (
      int istat
);

TypeNameRead/WriteDescription
intistatInputEnumerated value from mprobe
void RETURN

From EMBOSS 6.0.0


Function ajMemCheckSetLimit

Prints a message appropriate to the memcheck status

Prototype

void ajMemCheckSetLimit (
      ajint maxfail
);

TypeNameRead/WriteDescription
ajintmaxfailInputMaximum failures allowed
void RETURN

From EMBOSS 6.0.0


Function ajMemProbe

Probes a memory location for possible errors

Prototype

void ajMemProbe (
      void* ptr,
      const char* file,
      ajint line
);

TypeNameRead/WriteDescription
void*ptrModifyPointer to memory previously allocated with 'malloc'
const char*fileInputSource file name, generated by a macro.
ajintlineInputSource line number, generated by a macro.
void RETURN

From EMBOSS 6.0.0