Code Monkey home page Code Monkey logo

rmem's People

Contributors

marcorog avatar milostosic avatar wickerwaka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rmem's Issues

RMEM_STACK_TRACE_ENABLE_HASHING is not thread-safe

The callstack hashing system is not thread-safe. The caching structures themselves are not strictly thread-safe, but I don't think it is an issue in practice. There is the possible race condition when adding a new entry and you could end up with some mismatched entries in the cache. But I think the most common outcome is that the cache is less efficient because you could get some garbage entries in there is two threads wrote into the same stackIndex at the exact same time.

The problem I have encountered is the order the stacktraces are written to the data stream is not guaranteed.

Thread A encounters new callstack and records it in the cache
Context switch occurs and Thread B becomes active
Thread B encounters the same callstack and finds it in the cache
Thread B, having found the callstack cached, just writes the hash to the output stream.
Context switch occers and Thread A becomes active
Thread A writes the full callstack to the output stream.

The MTuner tool will error during reading when it encounters the hash written by Thread B because it hasn't encountered the full stack from Thread A first.

My local workaround for this is to write a placeholder value into (0xffffffff) into m_stackTraceHashes when adding a new entry and then replace it with the correct hash value after I have written to the output stream.

Support for building with clang-cl on windows

Hi

I'm working on building rmem as part of a CMake project compiled with clang-cl on Windows, but error: "Unsupported compiler!" lights up at rmem_platform.h:132

Any chance this build configuration (clang-cl/Windows) will be supported?

Stack corruption in MemoryHook::alloc

Duplicated from here because I realized I should file an issue:

I'm getting the following runtime check exception in debug builds of my app, when MemoryHook::alloc is called:

Run-Time Check Failure #2 - Stack around the variable 'tmpBufferPtr' was corrupted.

It looks like addStackTrace_new still tries to write sizeof(uintptr_t)*_numFrames to a stack allocated buffer that's now only the fixed 96 bytes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.