Removed SDL_FreeTemporaryMemory()

This was just causing confusion and anxiety. SDL temporary memory will be automatically freed on the main thread when processing events and on other threads when it ages out after a second. The application can free it directly by calling SDL_ClaimTemporaryMemory() to get ownership of the pointer, if necessary.
This commit is contained in:
Sam Lantinga
2024-07-22 07:18:00 -07:00
parent 70c1012e8c
commit ff1d351390
6 changed files with 34 additions and 88 deletions

View File

@@ -197,25 +197,10 @@ static int events_temporaryMemory(void *arg)
tmp = SDL_ClaimTemporaryMemory(mem);
SDLTest_AssertCheck(tmp == NULL, "SDL_ClaimTemporaryMemory() can't claim memory twice");
/* Verify that freeing the original pointer does nothing */
SDL_FreeTemporaryMemory(mem);
SDLTest_AssertCheck(*(char *)mem == '1', "SDL_FreeTemporaryMemory() on claimed memory has no effect");
/* Clean up */
SDL_free(claimed);
}
{
/* Create and free event memory */
mem = SDL_AllocateTemporaryMemory(1);
SDLTest_AssertCheck(mem != NULL, "SDL_AllocateTemporaryMemory()");
*(char *)mem = '1';
SDL_FreeTemporaryMemory(mem);
claimed = SDL_ClaimTemporaryMemory(mem);
SDLTest_AssertCheck(claimed == NULL, "SDL_ClaimTemporaryMemory() can't claim memory after it's been freed");
}
{
/* Create event memory and queue it */
mem = SDL_AllocateTemporaryMemory(1);