<div dir="ltr">I'll check every uint occurance, thank you. I'm on windows so I won't get the "maximum number of clients" error you talk about. The loop I used inside main was : <div>"<span style="font-family:arial,sans-serif;font-size:13px">while(true){</span><div style="font-family:arial,sans-serif;font-size:13px">
<span style="white-space:pre-wrap"> </span>curtrans=generateTransformationMatrix();</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap"> </span>for(int y=0;y<height;y++)</div>
<div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap"> </span>for(int x=0;x<width;x++)</div><div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap"> </span>i.data[(y*width+x)*4..y*width+x)*4+4]=colorify(applyTransformation(transformXY(x,y),curtrans)).dup[0..3] ~ 255;</div>
<div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap"> </span></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap"> </span>// and finally write the data to a png file</div>
<div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap"> </span>png = pngFromImage(i);</div><div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap"> </span>//std.file.write("images/"~toHexString(md5Of(curtrans))~".png", writePng(png));</div>
<div style="font-family:arial,sans-serif;font-size:13px">}"</div><div style="font-family:arial,sans-serif;font-size:13px">This doesn't use simpledisplay anymore so this should work fine on linux too?</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Adam checks this thread so he'll probably read the errors about simpledisplay. if not I'll copy paste and put in a bug report on github.</div><div>
--<br></div><div style><br></div><div style>The new fixes from adam rupe for png and image.d actually get rid of all memory leakages in my reduced version (without simpledisplay). Now I can get to finetuning my functions for the best images :)</div>
<div style><br></div><div style>I'll see if the simpledisplay version now works too (leave it running overnight).</div><div style>--</div></div><div style><br></div><div style>So, do we actually know where the memory problems came from? is anyone actually running out of memory too or am I the only one? (tested on both my pc and my laptop so should be reproducible)</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/13 Maxim Fomin <span dir="ltr"><<a href="mailto:maxim@maxim-fomin.ru" target="_blank">maxim@maxim-fomin.ru</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Friday, 10 May 2013 at 23:18:31 UTC, maarten van damme wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
I'm trying to generate images and after displaying them I want to save them<br>
to a png file. I use parallelism to generate them asynchronously with the<br>
gui-thread to avoid blocking (don't know if this is really relevant).<br>
<br>
If I add a single line in the method where I generate the image that<br>
creates a class which allocates a pretty big array, slowly but surely the<br>
memory starts to rise until it ends in a spectacular out of memory<br>
exception. I always thought the garbage collector would deal with it.<br>
<br>
I tried reducing it but failed. Maybe I should let dustmite bite in it a<br>
bit later.<br>
How can I manually fix this? Is this a known bug in the garbage collector?<br>
<br>
btw, this code also caused segfaults on my 64 bit laptop on linux.<br>
How can I avoid this?<br>
<br>
main class:<br>
</div><div class="im"><a href="https://dl.dropboxusercontent.com/u/15024434/picturegenerator/generalised.d" target="_blank">https://dl.dropboxusercontent.<u></u>com/u/15024434/<u></u>picturegenerator/generalised.d</a><br>
<br>
zip file with everything ready to go to compile:<br>
</div><a href="https://dl.dropboxusercontent.com/u/15024434/picturegenerator/picturegenerator.zip" target="_blank">https://dl.dropboxusercontent.<u></u>com/u/15024434/<u></u>picturegenerator/<u></u>picturegenerator.zip</a><br>
</blockquote>
<br>
1) your code is not compilable on 64x system due to erroneous treating of some platform-varying types as uint, use size_t. Luckily dmd has -m32 switch<br>
<br>
2) I encounter not out of memory exception but enforcement failure in simpledisplay.d:1024 "Maximum number of clients" which looks like not a memory error but you running out of some X server limit.<br>
<br>
3) Segfault occures in simpledisplay.d:1058 - in destructor you call XDestroyImage(handle) but do not check whether handle is null. However it happens after enforcement failure so it doesn't looks like root of problem.<br>
<br>
4) What really consumes memory is kernel or something which forces it to consume it since my task manager reports two blocks of 280 MB and 126 MB inside kernel part of virtual memory.<br>
</blockquote></div><br></div>