Skip to content
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

Fix game pools with __SANITIZE_ADDRESS__ #1161

Merged

Conversation

xezon
Copy link
Contributor

@xezon xezon commented Sep 19, 2024

This change fixes game pools with __SANITIZE_ADDRESS__.

Before, textures would just render black in w3dview tool. Unclear why exactly, but this change reinstates game pools and replaces the pool allocator with malloc and free.

Textures render normally now.

@xezon xezon requested a review from feliwir September 19, 2024 14:14
@feliwir feliwir force-pushed the fix-memory-allocators-for-asan branch from aa94a82 to b89cf74 Compare September 19, 2024 14:37
@@ -139,7 +143,9 @@ void MemoryPool::Free_Block(void *block)
if (block == nullptr) {
return;
}

#ifdef __SANITIZE_ADDRESS__
free(block);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should return afterwards? otherwise it will try deleting it otherwise / applying "delete"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is that delete? I do not see that.

@@ -94,8 +94,6 @@ void Init_Memory_Manager()
captainslog_dbgassert(g_thePreMainInitFlag, "memory manager is already inited");
}

#if defined GAME_DEBUG && !defined __SANITIZE_ADDRESS__
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@xezon xezon added the fixing label Sep 19, 2024
@feliwir feliwir merged commit 85ede0c into TheAssemblyArmada:develop Sep 20, 2024
7 checks passed
@xezon xezon deleted the fix-memory-allocators-for-asan branch September 20, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants