You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Inquiry: extra unity_memory support non-symmetric malloc and free #765
I'm currently using the Unity unit testing framework for my C projects and find it really helpful. I was wondering if there are any plans in the future to support asymmetric memory allocation and deallocation functions? This feature could be extremely useful in some specific scenarios where we need more fine-grained control over memory management during unit testing.
If it's not in the current roadmap, could you please consider adding it? It would greatly enhance the capabilities of the Unity framework and benefit many users like me.
Thank you very much for your time and consideration.
@vhexl -- I assume you're talking about the unity_memory files in extras? By non-symmetric, are you suggesting that instead of verifying the answer is zero at the end of each test, you have the option to specify a number of mallocs / frees that occurred, or something like that?
Yes, I meant ./extras/unity_memory, I tried using this extra to test some memory issues with queues, for queues malloc and free were not always symmetric, causing heap_index to not be 0, and I had to set a large UNITY_INTERNAL_HEAP_SIZE_BYTES size to make malloc work.
My code has an interface like this to use unity_malloc and unity_free
Activity
mvandervoord commentedon Jan 23, 2025
@vhexl -- I assume you're talking about the
unity_memoryfiles inextras? By non-symmetric, are you suggesting that instead of verifying the answer is zero at the end of each test, you have the option to specify a number of mallocs / frees that occurred, or something like that?vhexl commentedon Jan 24, 2025
Yes, I meant
./extras/unity_memory, I tried using this extra to test some memory issues with queues, for queues malloc and free were not always symmetric, causingheap_indexto not be 0, and I had to set a largeUNITY_INTERNAL_HEAP_SIZE_BYTESsize to make malloc work.My code has an interface like this to use
unity_mallocandunity_freeAbout
heap_indexUnity/extras/memory/src/unity_memory.c
Line 45 in ce122c4
By the way, maybe "heap_index" can be used as a heap memory "water mark"