#4633·colmap

GPU SIFT feature extraction crashes (heap corruption) during OpenGL buffer teardown on Windows

Author: jeffdailyCreated Aug 11, 2026Updated Aug 11, 2026

On Windows, running the GPU SIFT feature extractor crashes with a heap corruption error (STATUS_HEAP_CORRUPTION, 0xc0000374) during OpenGL buffer teardown, after the GPU computation itself has completed successfully. The failing unit test is ExtractSiftFeaturesGPU.Nominal in src/colmap/feature/sift_test.cc; the same crash occurs when extracting features through the normal pipeline with GPU SIFT enabled.

The crash happens in SiftGPU's pyramid destructor, in the glDeleteBuffers call that releases its pixel buffer objects (PyramidCU in src/thirdparty/SiftGPU). At that point the GPU descriptor computation has already finished and copied its results back to the host; only the OpenGL cleanup remains.

This looks like an OpenGL context lifecycle issue rather than a computation bug. OpenGLContextManager in src/colmap/util/opengl_utils.cc moves the shared GL context between threads with context_.moveToThread(...) driven by a Qt::BlockingQueuedConnection, and RunThreadWithOpenGLContext runs the worker on a separate std::thread while the calling thread drives the Qt event loop. The SiftGPU buffers appear to be deleted during teardown without their GL context being current on the thread that runs the destructor, and calling glDeleteBuffers with no current context is undefined behavior.

Environment where it reproduces:

  • Windows 11, hardware OpenGL context confirmed (GL_RENDERER reports the physical GPU, not a software rasterizer).
  • The OpenGL driver is the one shipped with the AMD Radeon graphics driver.

The same code path does not crash on Linux, where the OpenGL driver tolerates the buffer deletion without a current context. This points to a latent lifecycle problem that only some drivers surface.

Steps to reproduce:

  1. Build COLMAP on Windows with GPU SIFT enabled (a GUI build, so a real OpenGL context is available).
  2. Run colmap_feature_sift_test --gtest_filter=ExtractSiftFeaturesGPU.Nominal, or extract features from any image with the GPU extractor.
  3. Observe the process abort with STATUS_HEAP_CORRUPTION inside glDeleteBuffers during teardown. The GPU descriptor computation preceding it completes normally.

A verbose GPU trace shows the descriptor kernels running and the device-to-host copy of the descriptors succeeding before the crash, so the failure is confined to the OpenGL teardown and not the feature computation.


This issue was prepared with the help of an AI assistant acting as a coding agent and was read and approved by a person before it was opened. It comes from an ongoing effort to add AMD GPU support to widely used CUDA projects, one repository at a time: https://github.com/AMD-Ecosystem/moat -- that repository describes how the work is done and what a person checks before anything is submitted.

If you would rather not receive contributions from this effort, say so here or open an issue at https://github.com/AMD-Ecosystem/moat/issues/new/choose and we will stop. That can cover this repository alone or everything you own, whichever you prefer.