Compare commits
3 Commits
amiga2.1
...
mem-leak-d
Author | SHA1 | Date |
---|---|---|
Francesco Abbate | 6893cd7e29 | |
Francesco Abbate | 8ace5f6f77 | |
Francesco Abbate | 0cd1372b7f |
|
@ -414,6 +414,7 @@ function core.init()
|
|||
core.redraw = true
|
||||
core.visited_files = {}
|
||||
core.restart_request = false
|
||||
core.quit_request = false
|
||||
|
||||
core.root_view = RootView()
|
||||
core.command_view = CommandView()
|
||||
|
@ -524,7 +525,7 @@ local function quit_with_function(quit_fn, force)
|
|||
end
|
||||
|
||||
function core.quit(force)
|
||||
quit_with_function(os.exit, force)
|
||||
quit_with_function(function() core.quit_request = true end, force)
|
||||
end
|
||||
|
||||
|
||||
|
@ -853,12 +854,15 @@ function core.run()
|
|||
core.frame_start = system.get_time()
|
||||
local did_redraw = core.step()
|
||||
local need_more_work = run_threads()
|
||||
if core.restart_request then break end
|
||||
if core.quit_request or core.restart_request then break end
|
||||
if not did_redraw and not need_more_work then
|
||||
idle_iterations = idle_iterations + 1
|
||||
-- do not wait of events at idle_iterations = 1 to give a chance at core.step to run
|
||||
-- and set "redraw" flag.
|
||||
if idle_iterations > 1 then
|
||||
collectgarbage()
|
||||
local mk, mb = collectgarbage("count")
|
||||
io.stderr:write(string.format("memory usage %g \r", mk))
|
||||
if system.window_has_focus() then
|
||||
-- keep running even with no events to make the cursor blinks
|
||||
system.wait_event(frame_duration)
|
||||
|
|
|
@ -166,6 +166,9 @@ init_lua:
|
|||
|
||||
lua_close(L);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
|
||||
fprintf(stderr, "complete shutdown\n");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ struct GlyphSet {
|
|||
typedef struct GlyphSet GlyphSet;
|
||||
|
||||
struct RenFont {
|
||||
void *data;
|
||||
GlyphSet *sets[MAX_GLYPHSET];
|
||||
float size;
|
||||
int height;
|
||||
|
@ -158,10 +157,12 @@ void ren_free_font(RenFont *font) {
|
|||
for (int i = 0; i < MAX_GLYPHSET; i++) {
|
||||
GlyphSet *set = font->sets[i];
|
||||
if (set) {
|
||||
fprintf(stderr, "free font bitmap: %d\n", i);
|
||||
FR_Bitmap_Free(set->image);
|
||||
free(set);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "free font renderer\n");
|
||||
FR_Renderer_Free(font->renderer);
|
||||
free(font);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue