IDL

SHMDEBUG

SHMDEBUG

The SHMDEBUG function enables a debugging mode in which IDL prints an informational message (including a traceback) every time a variable created with the SHMVAR function loses its reference to the underlying memory segment created by. There are many reasons why a such a variable might lose its reference; some reasons have to do with the internal implementation of the IDL interpreter and are not obvious or visible to the IDL user.

Note: The SHMDEBUG debugging mode should be used for problem solving only, and should not be part of production code.

Examples


Create a memory segment, tie a variable to it, enable debugging, and then cause the variable to lose the reference:

old_debug = SHMDEBUG(1) ; Enable debug mode
SHMMAP, 'A', 100 ; 100 element floating vector
z = SHMVAR('A') ; Variable tied to segment
z[0] = FINDGEN(100) ; Does not lose reference
z = FINDGEN(100) ; Loses reference
 

IDL returns:

% Variable released shared memory segment: A
% Released at: $MAIN$

The assignment z[0] = FINDGEN(100) explicitly uses subscripting to assign the FINDGEN value to the array. Under normal circumstances, using subscripting in this way on the left hand side of an assignment is inefficient and not recommended. In this case, however, it has the desirable side effect of causing the variable Z to maintain its connection to its existing underlying memory. In contrast, the second (normally more desirable) assignment without the subscript causes IDL to allocate different memory for the variable Z, with the side effect of losing the connection to the shared memory segment.

Syntax


Result = SHMDEBUG(Enable)

Return Value


SHMDEBUG returns the previous setting of the debugging state.

Arguments


Enable

Set this argument equal to a non-zero value to enable debugging, or to zero to disable debugging.

Keywords


None.

Version History


5.6

Introduced

See Also


SHMMAP, SHMUNMAP, SHMVAR



Notes


This page has no user notes yet. Be the first one!


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2014 Exelis Visual Information Solutions