{"action":"closed","issue":{"url":"https://api.github.com/repos/ARM-software/CMSIS/issues/76","repository_url":"https://api.github.com/repos/ARM-software/CMSIS","labels_url":"https://api.github.com/repos/ARM-software/CMSIS/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/ARM-software/CMSIS/issues/76/comments","events_url":"https://api.github.com/repos/ARM-software/CMSIS/issues/76/events","html_url":"https://github.com/ARM-software/CMSIS/issues/76","id":148621386,"number":76,"title":"CMSIS RTOS API v2: Avoid mandatory dynamic allocation for all objects inadequate due to fragmentation","user":{"login":"ilg-ul","id":362732,"avatar_url":"https://avatars.githubusercontent.com/u/362732?v=3","gravatar_id":"","url":"https://api.github.com/users/ilg-ul","html_url":"https://github.com/ilg-ul","followers_url":"https://api.github.com/users/ilg-ul/followers","following_url":"https://api.github.com/users/ilg-ul/following{/other_user}","gists_url":"https://api.github.com/users/ilg-ul/gists{/gist_id}","starred_url":"https://api.github.com/users/ilg-ul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilg-ul/subscriptions","organizations_url":"https://api.github.com/users/ilg-ul/orgs","repos_url":"https://api.github.com/users/ilg-ul/repos","events_url":"https://api.github.com/users/ilg-ul/events{/privacy}","received_events_url":"https://api.github.com/users/ilg-ul/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-15T10:20:30Z","updated_at":"2016-04-15T12:16:45Z","closed_at":"2016-04-15T12:16:45Z","body":"The first major change I noticed in RTOS API v2 reads:\r\n\r\n```\r\nOS object's resources dynamically allocated rather than statically:\r\n- added: osXxxxNew functions which replace osXxxxCreate\r\n- removed: osXxxxCreate functions, osXxxxDef_t structures\r\n```\r\n\r\nImplementing this requires either a set of statically configured pools for each object type (separate pools for threads, mutexes, semaphores, pools, queues, mailboxes, flags, etc), which is highly discouraged, or the use of a true dynamic allocator, which is inacceptable for many applications due to fragmentation.\r\n\r\n[CMSIS++](http://micro-os-plus.github.io/cmsis-plus/) gives the user full control of the location where the objects are allocated, similar to C++, in other words objects can be statically allocated in the BSS, on the thread stack or on the heap (with a dynamic allocator like malloc()).\r\n\r\nSuggestion:\r\n\r\n* add a first parameter to the object creation function, with a pointer to a structure where the object will be emplaced; if this pointer is null, the object will be allocated dynamically using an implementation specific allocator.\r\n"}}