▸case-01 I am building a high-performance network service in C++ that frequently opens network sockets and allocates buffer blocks, but I'm worried about dangling pointers and memory leaks during error handling. Can you provide a structured refactoring guide outlining smart pointer usage, resource cleanup strategies upon failure, and actionable verification steps I can follow to ensure my code is leak-free? | pass→pass | 24,761 | 20,975 | -15% | 1 | 1 | 0% | 4,397 | 3,958 | -10% | 0 | 0 | — |
▸case-02 Our team is designing a cross-platform systems component in C++ and Rust that handles file handles and network connections. We need a detailed design plan that explains how to encapsulate these native descriptors using deterministic destruction and ownership patterns. Please format your response as a comparison breakdown with actionable implementation steps and validation techniques. | fail→pass | 43,658 | 29,429 | -33% | 1 | 1 | 0% | 8,131 | 4,705 | -42% | 0 | 0 | — |
▸case-03 We are encountering intermittent use-after-free bugs in our multithreaded C codebase when worker threads access shared state objects. Could you create a diagnostic and remediation blueprint that outlines lifecycle management techniques, safer resource ownership approaches, and verification steps to confirm the bugs are resolved? | pass→pass | 43,462 | 19,422 | -55% | 1 | 1 | 0% | 7,832 | 3,833 | -51% | 0 | 0 | — |
▸case-04 We are benchmarking a multithreaded C++ microservice and noticing cache line contention between worker threads updating adjacent array elements. How should we align our data structures in memory using C++11 attributes to eliminate false sharing? | pass→pass | 13,952 | 10,172 | -27% | 1 | 1 | 0% | 2,422 | 2,017 | -17% | 0 | 0 | — |
▸case-05 I need to set up CMake lists for a native C++ project so that symbol exports work correctly when generating dynamic libraries (.so on Linux and .dylib on macOS). What target property or visibility attribute setup should I configure? | fail→fail | 11,075 | 9,915 | -10% | 1 | 1 | 0% | 2,144 | 2,117 | -1% | 0 | 0 | — |
▸case-06 We are developing an embedded key-value storage engine and need to calculate the optimal B-tree node branching factor for 4KB disk block pages holding 16-byte keys and 8-byte child pointers. How do we compute the max degree? | pass→pass | 14,813 | 14,632 | -1% | 1 | 1 | 0% | 2,823 | 3,244 | +15% | 0 | 0 | — |
▸case-07 We are refactoring raw POSIX file descriptor calls (open/close) in a legacy C++ library to ensure cleanup happens automatically when exceptions are thrown. We want to wrap `int fd` into a custom C++ RAII class. What key design pattern and C++ methods (destructor, copy/move constructors) should we implement to guarantee exception-safe resource management? | pass→pass | 15,640 | 14,483 | -7% | 1 | 1 | 0% | 3,002 | 2,989 | -0% | 0 | 0 | — |
▸case-08 In our Rust network service, we have a struct holding references to configuration buffers that is rejected by the borrow checker with 'lifetime may not live long enough'. We want a step-by-step refactoring approach to resolve this reference lifetime conflict. What should we do? | pass→pass | 17,437 | 17,794 | +2% | 1 | 1 | 0% | 3,025 | 3,194 | +6% | 0 | 0 | — |
▸case-09 We have legacy C code handling raw `malloc` and `free` across multi-stage image processing pipelines where error handling paths frequently execute `free()` twice on the same pointer. What pattern or helper practice eliminates double-free vulnerabilities in standard C? | pass→pass | 15,671 | 11,162 | -29% | 1 | 1 | 0% | 2,726 | 2,337 | -14% | 0 | 0 | — |
▸case-10 Our C++ graph processing engine uses `std::shared_ptr` for node edges, but we noticed graph memory is never deallocated after parent graphs are destroyed. What smart pointer mechanism prevents memory leaks caused by cyclic references? | pass→pass | 12,567 | 8,555 | -32% | 1 | 1 | 0% | 2,283 | 1,790 | -22% | 0 | 0 | — |
▸case-11 We are integrating a third-party C library that uses `OpenHandle()` and `CloseHandle()` with C++ smart pointers. We want to wrap these handles in `std::unique_ptr` with custom deleters. How should we structure this wrapper? | pass→pass | 17,058 | 14,624 | -14% | 1 | 1 | 0% | 3,079 | 2,876 | -7% | 0 | 0 | — |
▸case-12 Our Linux daemon shows steadily increasing RSS memory usage under load. We want to diagnose whether this is caused by unreachable heap allocations or retained pointers. What diagnostic flags and tool options should we run to isolate the source of memory leaks? | pass→pass | 22,067 | 19,607 | -11% | 1 | 1 | 0% | 3,727 | 3,505 | -6% | 0 | 0 | — |
▸case-13 We are exposing a Rust library to C over FFI and passing raw pointers `*mut Data` back and forth across the foreign function boundary. What patterns ensure safe pointer reconstruction and prevent dangling pointers on the Rust side? | pass→pass | 18,166 | 16,215 | -11% | 1 | 1 | 0% | 3,322 | 3,162 | -5% | 0 | 0 | — |
▸case-14 Our C++ codebase contains legacy buffer manipulation code using raw array indexing `buffer[index] = val;` that caused buffer overflow security bugs. We want to transition to standard container abstractions that perform bounds checking. What pattern or method should replace raw bracket indexing? | pass→pass | 12,767 | 12,472 | -2% | 1 | 1 | 0% | 2,322 | 2,363 | +2% | 0 | 0 | — |
▸case-15 We are writing a high-frequency trading engine in C where individual heap allocations cause severe latency jitter. We want to replace per-object `malloc`/`free` with an arena allocator for request-scoped objects. What memory management pattern handles cleanup for the entire arena? | pass→pass | 14,915 | 10,498 | -30% | 1 | 1 | 0% | 2,536 | 2,051 | -19% | 0 | 0 | — |
▸case-16 We are implementing a custom C++ socket wrapper class and need to implement the move constructor `Socket(Socket&& other) noexcept`. How do we safely transfer the socket handle without leaving the source object in an invalid state that closes the socket on destruction? | pass→pass | 12,369 | 11,339 | -8% | 1 | 1 | 0% | 2,282 | 2,485 | +9% | 0 | 0 | — |
▸case-17 We want to enable runtime instrumentation in GCC and Clang builds to detect global buffer overflows, stack buffer overflows, and use-after-scope errors during unit tests. What compiler and linker flags are required? | pass→pass | 9,392 | 10,666 | +14% | 1 | 1 | 0% | 1,785 | 2,155 | +21% | 0 | 0 | — |
▸case-18 In a single-threaded Rust desktop GUI app, multiple widgets need mutable access to shared model data. What Rust standard library types enable shared ownership with runtime interior mutability? | pass→pass | 5,857 | 5,731 | -2% | 1 | 1 | 0% | 1,065 | 1,289 | +21% | 0 | 0 | — |
▸case-19 Our legacy C codebase relies heavily on `sprintf` to construct string responses, resulting in multiple stack buffer overflow CVEs reported during audit. What safer standard library functions should we refactor to, and how do we prevent buffer truncation issues? | pass→pass | 18,655 | 15,691 | -16% | 1 | 1 | 0% | 3,538 | 3,095 | -13% | 0 | 0 | — |
▸case-20 We are developing a resource management class in C++20 that owns a dynamically allocated raw buffer `char* buffer_`. Because we implemented a custom destructor `~Buffer()`, what additional member functions must we explicitly define or delete under C++ best practices? | pass→pass | 12,477 | 12,185 | -2% | 1 | 1 | 0% | 2,483 | 2,639 | +6% | 0 | 0 | — |
▸case-21 We have `unsafe` Rust code performing raw pointer offsets and casting in a custom lock-free queue. We want to test our unsafe code for undefined behavior like unaligned pointer dereferences and aliasing violations during CI. What tool in the Rust ecosystem detects UB in executable tests? | pass→pass | 11,020 | 7,557 | -31% | 1 | 1 | 0% | 1,959 | 1,600 | -18% | 0 | 0 | — |
▸case-22 We are designing a C++ container `push_back` operation that reallocates underlying dynamic memory. How do we ensure the strong exception guarantee so that if allocation or element copy throws, the container state remains completely untouched? | pass→pass | 19,855 | 17,640 | -11% | 1 | 1 | 0% | 3,731 | 3,377 | -9% | 0 | 0 | — |