1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

-Changed Godot exit to be clean.

-Added more debug information on memory cleanliness on exit (if run with -v)
-Fixed several memory leaks, fixes #1731, fixes #755
This commit is contained in:
Juan Linietsky
2015-04-20 19:38:02 -03:00
parent 28c4afeb57
commit 59154cccf9
37 changed files with 263 additions and 68 deletions

View File

@@ -28,7 +28,7 @@
/*************************************************************************/
#include "string_db.h"
#include "print_string.h"
#include "os/os.h"
StaticCString StaticCString::create(const char *p_ptr) {
StaticCString scs; scs.ptr=p_ptr; return scs;
}
@@ -55,15 +55,29 @@ void StringName::setup() {
void StringName::cleanup() {
_global_lock();
int lost_strings=0;
for(int i=0;i<STRING_TABLE_LEN;i++) {
while(_table[i]) {
_Data*d=_table[i];
_table[i]=_table[i]->next;
lost_strings++;
if (OS::get_singleton()->is_stdout_verbose()) {
if (d->cname) {
print_line("Orphan StringName: "+String(d->cname));
} else {
print_line("Orphan StringName: "+String(d->name));
}
}
_table[i]=_table[i]->next;
memdelete(d);
}
}
if (OS::get_singleton()->is_stdout_verbose() && lost_strings) {
print_line("StringName: "+itos(lost_strings)+" unclaimed string names at exit.");
}
_global_unlock();
}