{"id":31042942,"url":"https://github.com/hosseinmoein/cougar","last_synced_at":"2025-09-14T12:43:19.088Z","repository":{"id":197830847,"uuid":"699344630","full_name":"hosseinmoein/Cougar","owner":"hosseinmoein","description":"Modern C++ Stack and Static based allocators + a Custom Aligned allocator","archived":false,"fork":false,"pushed_at":"2024-03-31T17:03:56.000Z","size":19223,"stargazers_count":51,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-02T03:22:34.894Z","etag":null,"topics":["allocators","cache","cache-control","containers","cpp","cpp-programming","memory-allocation","memory-management"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hosseinmoein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["hosseinmoein"]}},"created_at":"2023-10-02T13:01:03.000Z","updated_at":"2024-04-01T15:18:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"18c90e8d-2c8a-4451-8fed-497129eb318c","html_url":"https://github.com/hosseinmoein/Cougar","commit_stats":null,"previous_names":["hosseinmoein/cougar"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hosseinmoein/Cougar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hosseinmoein%2FCougar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hosseinmoein%2FCougar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hosseinmoein%2FCougar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hosseinmoein%2FCougar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hosseinmoein","download_url":"https://codeload.github.com/hosseinmoein/Cougar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hosseinmoein%2FCougar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275107787,"owners_count":25406745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-14T02:00:10.474Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["allocators","cache","cache-control","containers","cpp","cpp-programming","memory-allocation","memory-management"],"created_at":"2025-09-14T12:43:15.852Z","updated_at":"2025-09-14T12:43:19.071Z","avatar_url":"https://github.com/hosseinmoein.png","language":"C++","funding_links":["https://github.com/sponsors/hosseinmoein"],"categories":[],"sub_categories":[],"readme":"\u003c!--\nCopyright (c) 2023-2028, Hossein Moein\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n* Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n* Neither the name of Hossein Moein and/or the Cougar nor the\nnames of its contributors may be used to endorse or promote products\nderived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL Hossein Moein BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n--\u003e\n![GitHub](https://img.shields.io/github/license/hosseinmoein/DataFrame.svg?color=red\u0026style=popout)\n[![C++20](https://img.shields.io/badge/C%2B%2B-20-blue.svg)](https://isocpp.org/std/the-standard )\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/hosseinmoein/DataFrame/graphs/commit-activity)\n\n\u003cimg src=\"docs/Cougar.png\" alt=\"Allocator Cougar\" width=\"400\" longdesc=\"https://htmlpreview.github.io/?https://github.com/hosseinmoein/Cougar/blob/master/README.md\"/\u003e\n\nThis repo includes several STL conformant allocators. There are two categories of allocators here:\n1. Stack or Static based fixed size allocators. In this category you pre-allocate a fixed size memory block either on the stack or statically. So you can have STL containers that are based on stack memory, for example. One of the side effects of these allocators is to overcome deficiencies in containers like \u003cI\u003emaps\u003c/I\u003e and \u003cI\u003elists\u003c/I\u003e where their memory by default is not cache-friendly.\n2. Custom Aligned allocator. This allocator allows you to allocate memory on a custom boundary. This way you can take advantage of SIMD instructions and techniques. \n\nPlease see the [tester file](test/allocator_tester.cc) for code samples.\n\nThis is the complete list of allocators in this repo:\n\n```cpp\n// An allocator that allows you to allocate memory for type T on boundary AS.\n// The default boundary is system default for type T.\ntemplate\u003ctypename T, std::size_t AS = 0\u003e\nAlignedAllocator\n```\n```cpp\n// This allocator pre-allocates memory for MAX_SIZE * sizeof(T) bytes statically.\n// It uses best-fit algorithm to find space. Best-fit is a bit slower,\n// but it causes considerably less fragmentations\ntemplate\u003ctypename T, std::size_t MAX_SIZE\u003e\nStaticBestFitAllocator\n```\n```cpp\n// This allocator pre-allocates memory for MAX_SIZE * sizeof(T) bytes on the stack.\n// It uses best-fit algorithm to find space. Best-fit is a bit slower,\n// but it causes considerably less fragmentations\ntemplate\u003ctypename T, std::size_t MAX_SIZE\u003e\nStackBestFitAllocator\n```\n```cpp\n// This allocator pre-allocates memory for MAX_SIZE * sizeof(T) bytes statically.\n// It uses first-fit algorithm to find space. First-fit is faster,\n// but it causes more fragmentations\ntemplate\u003ctypename T, std::size_t MAX_SIZE\u003e\nStaticFirstFitAllocator\n```\n```cpp\n// This allocator pre-allocates memory for MAX_SIZE * sizeof(T) bytes on the stack.\n// It uses first-fit algorithm to find space. First-fit is faster,\n// but it causes more fragmentations\ntemplate\u003ctypename T, std::size_t MAX_SIZE\u003e\nStackFirstFitAllocator\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhosseinmoein%2Fcougar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhosseinmoein%2Fcougar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhosseinmoein%2Fcougar/lists"}