Added UnmanagedMemoryContext class for allocating unmanaged memory, with automatic cleanup.