{"id":16745,"date":"2022-05-15T07:34:17","date_gmt":"2022-05-15T05:34:17","guid":{"rendered":"https:\/\/demdlx704as001.ad.harman.com\/?p=16745"},"modified":"2022-05-17T12:00:29","modified_gmt":"2022-05-17T10:00:29","slug":"memory-allocator-api-change","status":"publish","type":"post","link":"https:\/\/audioworx.transfunnel.co\/old\/?p=16745","title":{"rendered":"Memory Allocator API change"},"content":{"rendered":"<p>Data buffers placed in low latency memory leads to lower MIPS consumption and hence there will be numerous request for low latency memory. As there is limited low latency memory, the allocator allocates in the next available higher latency memory whenever the requested low latency memory is not available. Hence the memory statistics compiled with the requested latency might not be correct.<\/p>\n<p>An additional argument is passed to the memory allocator APIs to return the allocated latency for the requested data segment and this assigned latency level is used for calculating the memory usage at each latency level.<\/p>\n<p>The memory allocator APIs in the following xAF types header files are changed as shown below:<\/p>\n<p><strong>XafTypesC.h:<\/strong><\/p>\n<p><em><strong>typedef void<\/strong>* (*memAlloc)(<strong>unsigned int<\/strong> size, <strong>unsigned int<\/strong> align, <strong>enum<\/strong> xAF_HEAP, <strong>enum<\/strong> <strong>xAF_memLatency <\/strong>requestedLatency, <strong>xAF_memLatency<\/strong>* assignedLatency);<\/em><\/p>\n<p><strong>XafTypes.h:<\/strong><\/p>\n<p><em><strong>typedef void<\/strong>* (&amp;memAllocRef)(<strong>unsigned int<\/strong> size, <strong>unsigned int<\/strong> align, <strong>enum xAF_HEAP<\/strong> heap, <strong>enum xAF_memLatency<\/strong> requestedLatency, <strong>xAF_memLatency<\/strong>* assignedLatency);<\/em><\/p>\n<p>In the below classes, the APIs related to memory allocation are changed as given below:<\/p>\n<p><strong>CAudioCoreBase:<\/strong><\/p>\n<p><em><strong>void<\/strong>* m_Allocator(<strong>unsigned int<\/strong> size, <strong>unsigned int<\/strong> align, <strong>enum xAF_HEAP<\/strong> heap, <strong>enum xAF_memLatency<\/strong> requestedLatency, <strong>xAF_memLatency<\/strong>* assignedLatency);<\/em><\/p>\n<p><strong>InitializationMsgParser:<\/strong><\/p>\n<p><em><strong>void<\/strong>* m_memAlloc(<strong>unsigned int<\/strong> size, <strong>unsigned int<\/strong> align, <strong>enum xAF_HEAP<\/strong> heap, <strong>enum xAF_memLatency<\/strong> requestedLatency, <strong>xAF_memLatency<\/strong>* assignedLatency);<\/em><\/p>\n<p><strong>CAudioProcessingBase:<\/strong><\/p>\n<p><em><strong>void<\/strong>* heapCreator(<strong>unsigned int<\/strong> size, <strong>unsigned int<\/strong> align, <strong>enum xAF_HEAP<\/strong> heap, <strong>enum xAF_memLatency<\/strong> requestedLatency, <strong>xAF_memLatency<\/strong>* assignedLatency);<\/em><\/p>\n<p><strong>ChunkParserMem:<\/strong><\/p>\n<p><em><strong>void<\/strong>* m_memAlloc(<strong>unsigned int<\/strong> size, <strong>unsigned int<\/strong> align, <strong>enum xAF_HEAP<\/strong> heap, <strong>enum xAF_memLatency<\/strong> requestedLatency, <strong>xAF_memLatency<\/strong>* assignedLatency);<\/em><\/p>\n<p>The template to create object is also modified as below:<\/p>\n<p><em>createObject(<strong>void<\/strong>* (*heapCreator)(<strong>unsigned int<\/strong> size, <strong>unsigned int<\/strong> alignment, <strong>enum xAF_HEAP <\/strong>heap, <strong>enum xAF_memLatency <\/strong>requestedLatency, <strong>xAF_memLatency<\/strong>* assignedLatency)) {}<\/em><\/p>\n<p>In addition, following extern APIs used outside the framework are also modified:<\/p>\n<p><em>extern CAudioObject* createAudioObject(<strong>int<\/strong> id, void* (*heapCreator)(<strong>unsigned int<\/strong> size, <strong>unsigned int<\/strong> alignment, <strong>enum xAF_HEAP <\/strong>heap, <strong>enum xAF_memLatency <\/strong>requestedLatency, <strong>xAF_memLatency<\/strong>* assignedLatency));<\/em><\/p>\n<p><em>extern CAudioObjectToolbox* createAudioObjectToolbox(<strong>int<\/strong> id, void*(*heapCreator)(<strong>unsigned int<\/strong> size, <strong>unsigned int<\/strong> alignment, <strong>enum xAF_HEAP <\/strong>heap, <strong>enum xAF_memLatency <\/strong>requestedLatency, <strong>xAF_memLatency<\/strong>* assignedLatency));<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Data buffers placed in low latency memory leads to lower MIPS consumption and hence there will be numerous request for low latency memory. As there is limited low latency memory, the allocator allocates in the next available higher latency memory whenever the requested low latency memory is not available. Hence the memory statistics compiled with [&hellip;]<\/p>\n","protected":false},"author":90,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","footnotes":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[]},"categories":[1],"tags":[],"coauthors":[278],"_links":{"self":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts\/16745"}],"collection":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/users\/90"}],"replies":[{"embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16745"}],"version-history":[{"count":3,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts\/16745\/revisions"}],"predecessor-version":[{"id":16784,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts\/16745\/revisions\/16784"}],"wp:attachment":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16745"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fcoauthors&post=16745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}