{"id":21902514,"url":"https://github.com/jmininger/tlsf_memory_allocator","last_synced_at":"2025-06-21T10:38:36.259Z","repository":{"id":240404775,"uuid":"127980207","full_name":"jmininger/TLSF_memory_allocator","owner":"jmininger","description":"A dynamic memory allocator for real-time systems","archived":false,"fork":false,"pushed_at":"2021-07-12T16:27:40.000Z","size":643,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-27T06:46:25.992Z","etag":null,"topics":["allocator"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmininger.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2018-04-03T23:26:49.000Z","updated_at":"2023-03-21T22:26:01.000Z","dependencies_parsed_at":"2024-05-18T16:41:19.849Z","dependency_job_id":"9a5afe4d-a457-46cd-96ed-b023238914dc","html_url":"https://github.com/jmininger/TLSF_memory_allocator","commit_stats":null,"previous_names":["jmininger/tlsf_memory_allocator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmininger%2FTLSF_memory_allocator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmininger%2FTLSF_memory_allocator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmininger%2FTLSF_memory_allocator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmininger%2FTLSF_memory_allocator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmininger","download_url":"https://codeload.github.com/jmininger/TLSF_memory_allocator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244915690,"owners_count":20531260,"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","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":["allocator"],"created_at":"2024-11-28T15:19:29.214Z","updated_at":"2025-03-22T06:25:03.348Z","avatar_url":"https://github.com/jmininger.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Two Level Segregated Fit(TLSF) Dynamic Memory Allocator For Real-Time Systems\n\nNOTE: THIS IS A TOY PROJECT. DO NOT USE FOR ANYTHING IMPORTANT\n\nBased on the whitepaper from Miguel Masmano, Ismael Ripoll \u0026 Alfons Crespo.\n(See paper here: http://www.gii.upv.es/tlsf/files/ecrts04_tlsf.pdf)\nEven more information can be found here: http://www.gii.upv.es/tlsf/\n\nUse:\nvoid* tlsf_init(void* pool_start, size_t pool_size);\nvoid* tlsf_malloc(void* tlsf, size_t size);\nvoid tlsf_free(void *tlsf, void* ptr);\n\nSince the allocator is built for RT systems, no sbrk() syscall is used, and the \nmemory pool should be initialized before use. \n\nHow it works:\nProvides allocation/deallocation of memory blocks in constant, O(1), time\n\nThe structure contains an array indexed by log(2, reqSize). In other words, requests are split up based on the most significant bit of the requested size. Each entry in the array contains a pointer to the second level of the structure, which further partions the free blocks of each slab size into x more groups, where x is a configurable constant (in this particular implementation, x=16). This partioning is implemented by an array of size = x, and is indexed by taking the value of the log(2,x) bits that come after the most significant one. Each value points to the first element of a linked list of\nfree blocks (or is NULL).\n\nTo fulfill a tlsf_malloc(), the bitmaps showing the availibility of free blocks (of a given size\nclass) are used to find a free block in the matching size class (or if there are none, in a larger\nsize class) in constant time\n\nWhen tlsf_free() is called, the block checks for the possibility of coalescing with adjacent\nfree blocks and then returns the block to the free list \n\n-----------------------------------------------------------------------------\n|Main structure: Contains...                                                |\n| Segregated List(array of pointers to second levels)                       |\n| Bitmap showing which levels have free blocks                              |\n|                                                                           |\n|   Blocks fit into different size ranges:                                  |\n|                                                                           |\n|       |2^31|...|2^9|2^8|2^7|2^6|2^5|2^4                                   |\n-----------------------------------------------------------------------------\n                            |       |\n                            |       |       -------------------------\n                            |       |       |Level Two              |\n-------------------------   |       |_____\u003e |   Array of free lists |\n|Level Two              |\u003c__|               |   Bitmap              |\n|   Array of free lists |                   -------------------------\n|   bitmaps             |\n|   |   |   ... |   |   |\n-------------------------\n    |       |\n    |       |\n------------  ------------\n|Free_Block | |Free_Block |\n|           | |           |\n|           | |           |\n------------- -------------\n      |\n      |\n      | \n------------\n|Free_Block |\n|           |\n|           |\n-------------\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmininger%2Ftlsf_memory_allocator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmininger%2Ftlsf_memory_allocator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmininger%2Ftlsf_memory_allocator/lists"}