ALLOCATE and ON event statements reserve memory on the BASIC stack; therefore, a DEALLOCATE request may not immediately free memory for another use if it is not the next area of memory to come off the stack. Subprogram variables, including those ALLOCATEd, are automatically DEALLOCATEd upon subprogram exit. If you try to DEALLOCATE a variable which is not currently ALLOCATEd, you get an error.