IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2371


Ignore:
Timestamp:
Nov 15, 2004, 12:22:53 PM (22 years ago)
Author:
Paul Price
Message:

Added statement on use of restrict, and on use of persistent memory.

Location:
trunk/doc/pslib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/ChangeLogSDRS.tex

    r2367 r2371  
    1 %%% $Id: ChangeLogSDRS.tex,v 1.44 2004-11-15 20:20:30 price Exp $
     1%%% $Id: ChangeLogSDRS.tex,v 1.45 2004-11-15 22:22:48 price Exp $
    22
    33\subsection{Changes from version 00 to version 01}
     
    373373\item Removed errors from \code{psVectorFitSpline1D}.
    374374\item \code{psTraceReset} is to free memory used by \code{psTrace}.
     375\item Added requirement on use of persistent memory --- any use of
     376  persistent memory shall provide a function that frees the persistent
     377  memory.
     378\item Added statement on use of \code{restrict}.
    375379\end{itemize}
    376380
  • trunk/doc/pslib/psLibSDRS.tex

    r2367 r2371  
    1 %%% $Id: psLibSDRS.tex,v 1.150 2004-11-15 20:19:46 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.151 2004-11-15 22:22:53 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    158158convenience to the user.
    159159
     160\subsection{Use of \code{restrict}}
     161
     162The \code{restrict} type qualifier in C99 indicates to the compiler
     163that the memory pointed to by a particular pointer is not also pointed
     164to by some other pointer.  This allows the compiler to optimise the
     165code, based on the fact that aliasing is not an issue.  However, the
     166compiler does not check the accuracy of the assumption on which the
     167optimisation is made, which can lead to data corruption.
     168
     169Due to the large number of cross-links in psLib (e.g., the metadata
     170container keeps two pointers to the data), the assumption behind the
     171use of \code{restrict} generally will not hold.  Correspondingly, use
     172of \code{restrict} should be kept to a minimum; it should only be
     173employed where necessary, and where the assumption will hold.
     174
    160175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    161176
     
    363378only provided if the code is compiled with the preprocessor variable
    364379\code{PS_MEM_DEBUG} defined.
     380
     381\paragraph{Use of Persistent Memory}
     382
     383The \code{persistent} member of the \code{psMemBlock} is provided as a
     384convenience to the end-user of psLib --- it allows him to check for
     385memory leaks in his own code, without going to the trouble of freeing
     386memory allocated for psLib core functions.  It also allows the use of
     387psLib core functions (e.g., \code{psLogMsg, psTrace}) within the
     388function that is called by \code{psMemCheckLeaks}, without the memory
     389allocated by those psLib core functions being identified as a leak.
     390
     391For these reasons, the \code{persistant} feature should only be used
     392as necessary.  In order to allow proper testing of psLib, all
     393components that employ any \code{persistent} memory shall provide a
     394function that frees all of its \code{persistent} memory (and only that
     395persistent memory that belongs to that component).
    365396
    366397\subsubsection{APIs for Allocating and Freeing}
Note: See TracChangeset for help on using the changeset viewer.