On Friday, 17 June 2016 at 04:54:27 UTC, Joerg Joergonson wrote:
ok, then it's somewhere in TrueColorImage or the loading of the png.

So, opengltexture actually does reallocate if the size isn't right for the texture... and your image was one of those sizes.

The texture pixel size needs to be a power of two, so 3000 gets rounded up to 4096, which means an internal allocation.

But it can be a temporary one! So ketmar tackled png.d's loaders' temporaries and I took care of gamehelper.d's...

And the test program went down about to 1/3 of its memory usage. Try grabbing the new ones from github now and see if it works for you too.


Well, It works on LDC x64! again ;) This seems like an issue with DMD x64? I was thinking maybe it has to do the layout of the struct or something, but not sure.

I have a fix for this too, though I don't understand why it works....

I just .dup'd the string literal before passing it to Windows. I think dmd is putting the literal in a bad place for these functions (they do bit tests to see if it is a pointer or an atom, so maybe it is in an address where the wrong bits are set)

In any case, the .dup seems to fix it, so all should work on 32 or 64 bit now. In my tests, now that the big temporary arrays are manually freed, the memory usage is actually slightly lower on 32 bit, but it isn't bad on 64 bit either.


The CPU usage is consistently very low on my computer. I still don't know what could be causing it for you, but maybe it is the temporary garbage... let us know if the new patches make a difference there.

Anyways, We'll figure it all out at some point ;) I'm really liking your lib by the way. It's let me build a gui and get a lot done and just "work". Not sure if it will work on X11 with just a recompile, but I hope ;)


It often will! If you aren't using any of the native event handler functions or any of the impl.* members, most things just work (exception being the windows hotkey functions, but those are marked Windows anyway!). The basic opengl stuff is all done for both platforms. Advanced opengl isn't implemented on Windows yet though (I don't know it; my opengl knowledge stops in like 1998 with opengl 1.1 sooooo yeah, I depend on people's contributions for that and someone did Linux for me, but not Windows yet. I think.)

Reply via email to