Skip to content

Conversation

@vbe0201
Copy link
Member

@vbe0201 vbe0201 commented Sep 14, 2019

Summary

As discussed on Discord, this Pull Request mainly adds a memory allocator which is capable of mapping and managing a given memory region and implementations for shared_ptr and unqiue_ptr.

I also made the fix_codestyle script executable under Linux and reformatted everything with Clang-Format.

Goals

  • Adequate replacement for std::shared_ptr and std::unqiue_ptr.

  • Free of dependencies.

  • Lightweight implementation.

  • Clean and fast code.

  • Good documentation for Doxygen.

Limitations

  • Neither the memory allocator nor the smart pointers can be considered thread-safe.

    • Can be resolved by using a hs::os::Mutex.
  • No support for heap allocations.

  • No implementation of weak_ptr as I didn't consider it necessary.

    • If there's a demand, I can add it.
  • Only a subset of the smart pointers is actually implemented.

    • The implementations can be extended if necessary.

@Kaenbyo
Copy link
Member

Kaenbyo commented Sep 15, 2019

For reference:

We now have a shared_ptr/unique_ptr implementation that differ from the std counterpart.
This is mainly because we don't follow the allocator_traits requirements.

I also rewrote the memory allocator to use a simple free list (this still uses a first fit algorithm but I guess it's clearly enough for now).

The doc still need to be updated and some small optimization can be done on the free list fragmentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants