Clean up allocator on destruction.
Don't use Windows-specific _DEBUG directive.
Improved conditional DLL building.
Don't destroy potentially invalid material.