Trying to debug weird allocator crash bug; switching to windows

This commit is contained in:
Allen Webster 2020-01-19 12:00:58 -08:00
parent c0c3d7b220
commit 7817f8412d
2 changed files with 8 additions and 1 deletions

View File

@ -531,6 +531,9 @@ union SNode{
#define zdll_remove_front(f,l) zdll_remove_back_NP_((l),(f),prev,next)
#define zdll_remove(f,l,n) zdll_remove_NP_((f),(l),(n),next,prev)
#define zdll_assert_good(T,f) Stmnt( if (f != 0){ Assert(f->prev == 0); \
for(T *p_ = f; p_ != 0; p_ = p_->next){ Assert(p_->prev == 0 || p_->prev->next == p_); Assert(p_->next == 0 || p_->next->prev == p_); } } )
////////////////////////////////
union Vec2_i8{

View File

@ -748,8 +748,10 @@ mac_memory_allocate_extended(void *base, u64 size, String_Const_u8 location){
pthread_mutex_lock(&memory_tracker_mutex);
{
zdll_assert_good(Memory_Annotation_Tracker_Node, memory_tracker.first);
zdll_push_back(memory_tracker.first, memory_tracker.last, node);
memory_tracker.count += 1;
zdll_assert_good(Memory_Annotation_Tracker_Node, memory_tracker.first);
}
pthread_mutex_unlock(&memory_tracker_mutex);
@ -767,8 +769,10 @@ mac_memory_free_extended(void *ptr){
pthread_mutex_lock(&memory_tracker_mutex);
{
zdll_assert_good(Memory_Annotation_Tracker_Node, memory_tracker.first);
zdll_remove(memory_tracker.first, memory_tracker.last, node);
memory_tracker.count -= 1;
zdll_assert_good(Memory_Annotation_Tracker_Node, memory_tracker.first);
}
pthread_mutex_unlock(&memory_tracker_mutex);