Skip to content

Should increase mt_in_use_c only when the new mem_entry_t is allocated #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions dmalloc_tab.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,23 +591,25 @@ void _dmalloc_table_insert(mem_table_t *mem_table,
mem_entry_t *entry_p;

entry_p = table_find(mem_table, file, line);
if (entry_p->me_file == NULL
&& mem_table->mt_in_use_c > mem_table->mt_entry_n / 2) {
/* do we have too many entries in the table? then put in other bucket. */
entry_p = &mem_table->mt_other_pointers;
} else if (entry_p != &mem_table->mt_other_pointers) {
/* we found an open slot so update the file/line */
entry_p->me_file = file;
entry_p->me_line = line;
mem_table->mt_in_use_c++;
if (entry_p->me_file == NULL) {
if (mem_table->mt_in_use_c > mem_table->mt_entry_n / 2) {
/* do we have too many entries in the table? then put in other bucket. */
entry_p = &mem_table->mt_other_pointers;
}
else {
/* we found an open slot so update the file/line */
entry_p->me_file = file;
entry_p->me_line = line;
entry_p->me_entry_pos_p = entry_p;
mem_table->mt_in_use_c++;
}
}

/* update the info for the entry */
entry_p->me_total_size += size;
entry_p->me_total_c++;
entry_p->me_in_use_size += size;
entry_p->me_in_use_c++;
entry_p->me_entry_pos_p = entry_p;
}

/*
Expand Down