On Sunday, 12 June 2016 at 13:23:26 UTC, Adam D. Ruppe wrote:
On Sunday, 12 June 2016 at 13:05:48 UTC, Joerg Joergonson wrote:
BTW, when I compile a simple project with your simpledisplay
it takes up around 300MB(for ldc, 400 for dmd) and uses about
15% cpu.
What's your code? The library itself does fairly little so the
time probably depends on your draw loop or timer settings
(though it did have a memory leak until recently, it wasn't
apparent until something had been running for a really long
time - I use it in my day-to-day terminal emulator, so I have
like 40 copies of the process running for months on end here...)
I'm leaving in 2 minutes for church btw so I might not answer
you for about 5 hours when I'm back at the computer.
Well, it's about the same when I comment all my code out! It
drops about 30 megs and a percent or two but still quite large.
When I remove all code, it is 2MB in size and 0 cpu(I just use
Sleep to keep it from terminating).
When I try to use a sleep before the event loop to and just call
create2dWindow, I get
Error: undefined identifier 'Sleep' in module 'core.thread', did
you mean function 'Sleep'?
Which godly in it's descriptive powers, right?
The code added is
import core.thread;
core.thread.Sleep(10000);
which is the same code I use in main() which works(worked)
import core.thread : Sleep;
Sleep(10000);
works though. Basically keeping the event loop uses around 12%
cpu and 12MB of memory. Adding in my code, which simply uses your
png to load some images and display them balloons it to 400MB.
The exe is only 7MB in size.
So, I believe it is your code. The event loop is using quite a
bit of cpu even when not "doing" anything(haven't look at it
behind the scenes though).
The memory is probably from loading the images, possibly doubling
all the images to powers of 2 might explain some of the bloat. I
have a few large images that when uncompressed might be 20-40MB
total and several smaller ones, probably insignificant. Shouldn't
add up to 300MB though.
Once I get further in I'll try to see whats going on. I haven't
noticed it leaking memory though.
Do you know if there is a way to get the largest used memory
chunks and what is using them? That might tell the story!