Skip to content

Memory corruption bug #44

@MikeCernea

Description

@MikeCernea

Summary

I’m seeing intermittent SEGV_ACCERR crashes when using the mapmap optimizer to select the best camera for each face during mesh texturing. The optimization itself works, but the process occasionally ends with a memory access violation.

The crashes also occur when forcing a single thread, so it doesn’t look like a straightforward data race.


Details

  • Component: mapmap optimizer (used for per-face best camera selection in mesh texturing)
  • Repro: on my dataset, the crash happens roughly 1 in 5 runs
  • Failure mode: GeneralDPNodeSolver::optimize_node() inside an AVX intrinsic (avxintrin.h:911), with SEGV_ACCERR (access error - permission violation, not unmapped memory) / memory corruption–style crash

I also noticed this allocator pattern in a couple of places:

m_value_allocator(
    (tbb::tbb_allocator<_s_t<COSTTYPE, SIMDWIDTH>>*)(
        new tbb::cache_aligned_allocator<_s_t<COSTTYPE, SIMDWIDTH>>
    )
);

I don’t understand the purpose of allocating a tbb::cache_aligned_allocator and then casting it to tbb::tbb_allocator. I tried changing it to:

m_value_allocator(
    new tbb::cache_aligned_allocator<_s_t<COSTTYPE, SIMDWIDTH>>()
);

but the intermittent crash still occurs.


Questions

  1. Has anyone seen similar intermittent SEGV_ACCERR / memory corruption issues with mapmap?
  2. What is the intended rationale for the allocator recast above?
    • Is this pattern actually safe, or could it be undefined behavior and related to the crash?
  3. Is there a recommended way to configure allocators for mapmap (especially if cache-aligned allocation is desired)?

I can provide stack traces, build flags, and environment details if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions