Main Page | Class List | Directories | File List | Class Members | File Members

ObitMem.c File Reference

ObitMem Module definition file. More...

#include <string.h>
#include "ObitMem.h"

Classes

struct  memTableElem
struct  ObitMemClassInfo
 ObitMem Class structure. More...
struct  ObitMemValidStruc
 Structure to use in validity testing. More...

Functions

gpointer ObitMemAlloc (gulong size)
 Public: allocate memory.
gpointer ObitMemAlloc0 (gulong size)
 Public: allocate memory and zero fill.
gpointer ObitMemAllocName (gulong size, gchar *name)
 Public: allocate memory giving name.
gpointer ObitMemAlloc0Name (gulong size, gchar *name)
 Public: allocate memory and zero fill, giving name.
gpointer ObitMemRealloc (gpointer mem, gulong size)
 Public: reallocate memory.
gpointer ObitMemFree (gpointer mem)
 Public: deallocate.
gboolean ObitMemValid (gpointer mem)
 Public: Check if in allocated block.
void ObitMemPrint (FILE *file)
 Public: Print contents to file (e.g.
void ObitMemSummary (glong *number, glong *total)
 Public: Summary of contents.
void ObitMemClassInit (void)
 Public: Class initializer.


Detailed Description

ObitMem Module definition file.

Obit Memory management class Use compiler switch -DFASTOBITMEM to disable checking or -DMEMWATCH to use MEMWATCH debugging


Function Documentation

gpointer ObitMemAlloc gulong  size  ) 
 

Public: allocate memory.

Implementation used g_malloc

Parameters:
size Number of bytes requested
Returns:
pointer to allocated memory, NULL on failure

gpointer ObitMemAlloc0 gulong  size  ) 
 

Public: allocate memory and zero fill.

Implementation uses g_malloc0

Parameters:
size Number of bytes requested
Returns:
pointer to allocated memory, NULL on failure

gpointer ObitMemAlloc0Name gulong  size,
gchar *  name
 

Public: allocate memory and zero fill, giving name.

Implementation uses g_malloc0

Parameters:
size Number of bytes requested
name Name for entry, up to 20 char. Useful for debugging.
Returns:
pointer to allocated memory, NULL on failure

gpointer ObitMemAllocName gulong  size,
gchar *  name
 

Public: allocate memory giving name.

Initializes class if needed on first call. Implementation used g_malloc

Parameters:
size Number of bytes requested
name Name for entry, up to 20 char. Useful for debugging.
Returns:
pointer to allocated memory, NULL on failure

void ObitMemClassInit void   ) 
 

Public: Class initializer.

gpointer ObitMemFree gpointer  mem  ) 
 

Public: deallocate.

This is a NOP if mem is not to a valid block of memory. Note: ONLY FREE MEMORY ALLOCATED BY ObitMem!!! Implementation used g_free

Parameters:
mem Pointer to memory to be freed.
Returns:
pointer to allocated memory, NULL on failure

void ObitMemPrint FILE *  file  ) 
 

Public: Print contents to file (e.g.

stdout)

Parameters:
file to print to.

gpointer ObitMemRealloc gpointer  mem,
gulong  size
 

Public: reallocate memory.

Parameters:
mem Pointer to old memory, if null, allocates anonymous slot
size Number of bytes requested
Returns:
pointer to allocated memory, NULL on failure

void ObitMemSummary glong *  number,
glong *  total
 

Public: Summary of contents.

Parameters:
number Number of entries
total Total memory allocated in MByte

gboolean ObitMemValid gpointer  mem  ) 
 

Public: Check if in allocated block.

Parameters:
mem Pointer to memory to be tested.
Returns:
TRUE if in allocated block, else FALSE


Generated on Fri Aug 31 22:13:07 2007 for Obit by  doxygen 1.3.9.1