qcacmn: Add qdf memory domain support

In order to support memory leak detection during a specific period of
time, add APIs to allow setting the current memory domain. Each
allocation is tracked against the current memory domain at the time of
allocation. Consumers can then check to ensure the memory domain is
empty before each transition to a different domain.

Change-Id: I3a8d18ea0700122a2425eacb6051c6188b9aa5d6
CRs-Fixed: 2113614
This commit is contained in:
Dustin Brown
2017-08-16 16:42:07 -07:00
committed by snandini
父節點 dbbb61a6cd
當前提交 47d702f693
共有 4 個文件被更改,包括 320 次插入322 次删除

查看文件

@@ -99,10 +99,42 @@ void qdf_mem_exit(void);
#define qdf_mem_malloc(size) \
qdf_mem_malloc_debug(size, __FILE__, __LINE__)
void *qdf_mem_malloc_debug(size_t size, char *file_name, uint32_t line_num);
/**
* qdf_mem_check_for_leaks() - Assert that the current memory domain is empty
*
* Call this to ensure there are no active memory allocations being tracked
* against the current debug domain. For example, one should call this function
* immediately before a call to qdf_debug_domain_set() as a memory leak
* detection mechanism.
*
* e.g.
* qdf_debug_domain_set(QDF_DEBUG_DOMAIN_ACTIVE);
*
* ...
*
* // memory is allocated and freed
*
* ...
*
* // before transitioning back to inactive state,
* // make sure all active memory has been freed
* qdf_mem_check_for_leaks();
* qdf_debug_domain_set(QDF_DEBUG_DOMAIN_INIT);
*
* ...
*
* // also, before program exit, make sure init time memory is freed
* qdf_mem_check_for_leaks();
* exit();
*
* Return: None
*/
void qdf_mem_check_for_leaks(void);
#else
void *
qdf_mem_malloc(qdf_size_t size);
#endif
void *qdf_mem_malloc(qdf_size_t size);
static inline void qdf_mem_check_for_leaks(void) { }
#endif /* MEMORY_DEBUG */
void *qdf_mem_alloc_outline(qdf_device_t osdev, qdf_size_t size);