Ordinarily, the parser will automatically delete lcis you have allocated and installed. However, you may have a case where simply freemem()ing your LCI is not enough; you may need to free some ancillary memory, or decrement a counter, or send a signal, or something. This is where setlocalitempurge() comes in. it is called as follows: SetLocalItemPurge (lci, hookptr); When the parser is ready to delete your lci, your purge handler code will be called through the hook you supplied. you can then perform all your necessary operations. One of these operations should be to free the LCI itself. This is done with freelocalitem(): FreeLocalItem (lci); This deallocates the memory used to store the lci and the client buffer allocated with it. freelocalitem() is only called as part of a custom purge handler. As with custom chunk handlers, your purge handler executes in the same environment as the mainline code that called parseiff(). it is recommended that you keep purge handlers short and to the point; super clever stuff should be reserved for custom chunk handlers, or for the client's mainline code. Custom purge handlers must always work; failures will be ignored.