Removed temporary memory from the API
It was intended to make the API easier to use, but various automatic garbage collection all had flaws, and making the application periodically clean up temporary memory added cognitive load to using the API, and in many cases was it was difficult to restructure threaded code to handle this. So, we're largely going back to the original system, where the API returns allocated results and you free them. In addition, to solve the problems we originally wanted temporary memory for: * Short strings with a finite count, like device names, get stored in a per-thread string pool. * Events continue to use temporary memory internally, which is cleaned up on the next event processing cycle.
This commit is contained in:
@@ -61,7 +61,7 @@ static int SDLCALL enum_callback(void *userdata, const char *origdir, const char
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SDLTest_CommonState *state;
|
||||
const char *pref_path;
|
||||
char *pref_path;
|
||||
const char *base_path;
|
||||
|
||||
/* Initialize test framework */
|
||||
@@ -98,6 +98,7 @@ int main(int argc, char *argv[])
|
||||
} else {
|
||||
SDL_Log("pref path: '%s'\n", pref_path);
|
||||
}
|
||||
SDL_free(pref_path);
|
||||
|
||||
pref_path = SDL_GetPrefPath(NULL, "test_filesystem");
|
||||
if (!pref_path) {
|
||||
@@ -106,9 +107,10 @@ int main(int argc, char *argv[])
|
||||
} else {
|
||||
SDL_Log("pref path: '%s'\n", pref_path);
|
||||
}
|
||||
SDL_free(pref_path);
|
||||
|
||||
if (base_path) {
|
||||
const char * const *globlist;
|
||||
char **globlist;
|
||||
SDL_IOStream *stream;
|
||||
const char *text = "foo\n";
|
||||
|
||||
@@ -124,6 +126,7 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; globlist[i]; i++) {
|
||||
SDL_Log("GLOB[%d]: '%s'", i, globlist[i]);
|
||||
}
|
||||
SDL_free(globlist);
|
||||
}
|
||||
|
||||
/* !!! FIXME: put this in a subroutine and make it test more thoroughly (and put it in testautomation). */
|
||||
|
||||
Reference in New Issue
Block a user