ARSD PNG memory usage

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 16 21:32:02 PDT 2016


On Friday, 17 June 2016 at 01:51:41 UTC, Joerg Joergonson wrote:
> Are you keeping multiple buffers of the image around? A 
> trueimage, a memoryimage, an opengl texture

MemoryImage and TrueImage are the same thing, memory is just the 
interface, true image is the implementation.

OpenGL texture is separate, but it references the same memory as 
a TrueColorImage, so it wouldn't be adding.


You might have pinned temporary buffers though. That shouldn't 
happen on 64 bit, but on 32 bit I have seen it happen a lot.

> When I do a bare loop minimum project(create2dwindow + event 
> handler) I get 13% cpu(on 8-core skylake 4ghz) and 14MB memory.

I haven't seen that here.... but I have a theory now: you have 
some pinned temporary buffer on 32 bit (on 64 bit, the GC would 
actually clean it up) that keeps memory usage near the collection 
boundary.

Then, a small allocation in the loop - which shouldn't be 
happening, I don't see any in here... - but if there is a small 
allocation I'm missing, it could be triggering a GC collection 
cycle each time, eating CPU to scan all that wasted memory 
without being able to free anything.

If you can run it in the debugger and just see where it is by 
breaking at random, you might be able to prove it.

That's a possible theory.... I can reproduce the memory usage 
here, but not the CPU usage though. Sitting idle, it is always 
<1% here (0 if doing nothing, like 0.5% if I move the mouse in 
the window to generate some activity)

  I need to get to bed though, we'll have to check this out in 
more detail later.


> Thanks!  Also, when I try to run the app in 64-bit windows, 
> RegisterClassW throws for some reason ;/ I haven't been able to 
> figure that one out yet ;/

errrrrr this is a mystery to me too... a hello world on 64 bit 
seems to work fine, but your program tells me error 998 (invalid 
memory access) when I run it. WTF, both register class the same 
way.

I'm kinda lost on that.


More information about the Digitalmars-d-learn mailing list