Somewhat similar to How to erase/delete a counter, I guess, but for \newdimen... So, consider the MWE:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\newdimen\dx
\def\mytest{AA}
\typeout{\meaning\dx, \meaning\mytest}
\end{tikzpicture}
\typeout{\meaning\dx, \meaning\mytest}
\end{document}
The code outputs to stdout:
\dimen152, macro:->AA
\dimen152, undefined
I use tikzpicture just as a way to group; it is clear from the output, that the reference to the macro locally defined in the group, does not survive outside the group; however, the reference to the length \dx created by \newdimen did indeed survive.
So in case I want to deallocate / dereference \dx, such that \dimen152 "goes back" to the pool of "unused" \dimens (if at all possible), what should I do?
expl3we've explored local allocations and at present haven't gone with them. – Joseph Wright Jun 19 '14 at 06:15\let\dx\undefined(where\undefinedis any undefined macro) eventually "free" the corresponding register? – sdaau Jun 19 '14 at 11:58