Static arrays / File imports cause memory leaks

bobef aasd.aasdasd.asd.ad.ad.as.d.a at asdasdas.das.da.d.ad.sa.d
Wed Jan 13 10:58:41 PST 2010


I can't reproduce this but I think it worths mentioning. I just finished debugging a memory leak. It turned out to be compiler problem (dmd 1.035 windows). I had two big static arrays in a class member function (around 200kb each) and using my app as usual was causing huge memory leaks. Replacing these with dynamic arrays solved it.

In another case importing a file (static const a = import("myfile.txt")), where myfile was around 1.2mb was causing huge huge memory leaks. The actual code in the function that had this import was called only once in the program lifetime but it was messing something so just using the rest of the program was causing progressive memory leaks... Moving this in the exe as rcdata solved it.

Sorry I can't reproduce these in a small test case but it is definitely a compiler bug so I guess it worths mentioning anyway...

Regards


More information about the Digitalmars-d-bugs mailing list