{"id":20560914,"url":"https://github.com/aben20807/os_hw4_memory_allocator","last_synced_at":"2025-08-21T15:40:55.836Z","repository":{"id":107925543,"uuid":"118053430","full_name":"aben20807/os_hw4_memory_allocator","owner":"aben20807","description":"Operating Systems Homework 4. Run in Ubuntu14.04","archived":false,"fork":false,"pushed_at":"2018-10-18T09:45:29.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T16:11:24.220Z","etag":null,"topics":["best-fit","c","lib","linked-list","malloc-free","sbrk"],"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/aben20807.png","metadata":{"files":{"readme":"README.md","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-01-19T00:04:54.000Z","updated_at":"2018-10-18T09:45:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"b4c0ddab-ffd4-4948-8c80-d4b38c9de995","html_url":"https://github.com/aben20807/os_hw4_memory_allocator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aben20807/os_hw4_memory_allocator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aben20807%2Fos_hw4_memory_allocator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aben20807%2Fos_hw4_memory_allocator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aben20807%2Fos_hw4_memory_allocator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aben20807%2Fos_hw4_memory_allocator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aben20807","download_url":"https://codeload.github.com/aben20807/os_hw4_memory_allocator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aben20807%2Fos_hw4_memory_allocator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260976921,"owners_count":23091528,"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":["best-fit","c","lib","linked-list","malloc-free","sbrk"],"created_at":"2024-11-16T03:56:17.026Z","updated_at":"2025-06-20T16:11:43.091Z","avatar_url":"https://github.com/aben20807.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# os_hw4_memory_allocator\r\n+ Implement a memory allocator library\r\n+ 3 functions\r\n    + `void *hw_malloc(size_t bytes);`\r\n    + `int hw_free(void *mem);`\r\n    + `void *hw_get_start_brk();`\r\n\r\n## Chunk\r\n+ header: 40 bytes\r\n    + `prev`: point to next free chunk in same list\r\n    + `next`: point to prev free chunk in same list\r\n    + `chunk_size`: the size of this chunk\r\n    + `prev_chunk_size`: the size of prev adjacent chunk\r\n    + `prev_free_flag`: prev adjacent chunk is free (`1`) or not (`0`)\r\n```\r\n        +-------------------------------+\r\n        .          next chunk           .\r\n        .                               .\r\n        +-------------------------------+\r\n        |          chunk data           |\r\n   mem-\u003e+-------------------------------+\r\n header:| chunk_ptr_t prev;             |\r\n        | chunk_ptr_t next;             |\r\n        | chunk_size_t chunk_size;      |\r\n        | chunk_size_t prev_chunk_size; |\r\n        | chunk_flag_t prev_free_flag;  |\r\n        +-------------------------------+\r\n        .          prev chunk           .\r\n        .                               .\r\n        +-------------------------------+\r\n```\r\n\r\n## Bins\r\n+ doubly-linked list\r\n+ 7 bins\r\n    + `bin[0]`: 48 bytes (include header)\r\n    + `bin[1]`: 56 bytes\r\n    + `bin[2]`: 64 bytes\r\n    + `bin[3]`: 72 bytes\r\n    + `bin[4]`: 80 bytes\r\n    + `bin[5]`: 88 bytes\r\n    + `bin[6]`: \u003e 88 bytes\r\n\r\n```\r\n    +--------+\r\n    | bin[0] |\r\n    +--------+\r\n       ↕    ↑\r\n    +----+  |\r\n    | 48 |  |\r\n    +----+  |\r\n       ↕    |\r\n    +----+  |\r\n    | 48 | ←┘\r\n    +----+\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faben20807%2Fos_hw4_memory_allocator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faben20807%2Fos_hw4_memory_allocator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faben20807%2Fos_hw4_memory_allocator/lists"}