mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-29 18:54:34 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user