SQL Server 2005, custom extended procedure memory

Very informative post on Being careful with xproc memory allocation when writing extended procedures for SQL Server