Cleanup: Readfile: Remove old disabled debug code for memory leaks tracking.

This was not working at all with ASAN builds, and has been superseded by the
new system introduced in recent commits 63016ad965 and add9553ad1.
This commit is contained in:
Bastien Montagne
2024-07-29 17:07:27 +02:00
parent 4e6237e009
commit bae9a93d62

View File

@@ -2466,26 +2466,6 @@ static BHead *read_data_into_datamap(FileData *fd,
bhead = blo_bhead_next(fd, bhead);
while (bhead && bhead->code == BLO_CODE_DATA) {
/* The code below is useful for debugging leaks in data read from the blend file.
* Without this the messages only tell us what ID-type the memory came from,
* eg: `Data from OB len 64`, see #dataname.
* With the code below we get the struct-name to help tracking down the leak.
* This is kept disabled as the #malloc for the text always leaks memory. */
#if 0
if (bhead->SDNAnr == 0) {
/* The data type here is unclear because #writedata sets SDNAnr to 0. */
allocname = "likely raw data";
}
else {
SDNA_Struct *sp = fd->filesdna->structs[bhead->SDNAnr];
allocname = fd->filesdna->types[sp->type];
size_t allocname_size = strlen(allocname) + 1;
char *allocname_buf = static_cast<char *>(malloc(allocname_size));
memcpy(allocname_buf, allocname, allocname_size);
allocname = allocname_buf;
}
#endif
void *data = read_struct(fd, bhead, allocname, id_type_index);
if (data) {
const bool is_new = oldnewmap_insert(fd->datamap, bhead->old, data, 0);