mod_mem.h File Reference

Module for dynamic memory management. More...

Go to the source code of this file.

Functions

void * stm_malloc (size_t size)
 Allocate memory from inside a transaction.
void stm_free (void *addr, size_t size)
 Free memory from inside a transaction.
void stm_free2 (void *addr, size_t idx, size_t size)
 Free memory from inside a transaction.
void mod_mem_init (int gc)
 Initialize the module.

Detailed Description

Module for dynamic memory management.

This module provides functions for allocations and freeing memory inside transactions. A block allocated inside the transaction will be implicitly freed upon abort, and a block freed inside a transaction will only be returned to the system upon commit.

Author:
Pascal Felber <pascal.felber@unine.ch>
Date:
2007-2009

Function Documentation

void mod_mem_init ( int  gc  ) 

Initialize the module.

This function must be called once, from the main thread, after initializing the STM library and before performing any transactional operation.

Parameters:
gc True (non-zero) to enable epoch-based garbage collector when freeing memory in transactions.
void stm_free ( void *  addr,
size_t  size 
)

Free memory from inside a transaction.

Freed memory is only returned to the system upon commit and can optionally be overwritten (more precisely, the locks protecting the memory are acquired) to prevent another transaction from accessing the freed memory and observe inconsistent states.

Parameters:
addr Address of the memory block.
size Number of bytes to overwrite.
void stm_free2 ( void *  addr,
size_t  idx,
size_t  size 
)

Free memory from inside a transaction.

Freed memory is only returned to the system upon commit and can optionally be overwritten (more precisely, the locks protecting the memory are acquired) to prevent another transaction from accessing the freed memory and observe inconsistent states.

Parameters:
addr Address of the memory block.
idx Index of the first byte to overwrite.
size Number of bytes to overwrite.
void* stm_malloc ( size_t  size  ) 

Allocate memory from inside a transaction.

Allocated memory is implicitly freed upon abort.

Parameters:
size Number of bytes to allocate.
Returns:
Pointer to the allocated memory block.
Generated on Mon Feb 22 15:49:59 2010 for TinySTM by  doxygen 1.6.3