www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Static arrays / File imports cause memory leaks

reply bobef <aasd.aasdasd.asd.ad.ad.as.d.a asdasdas.das.da.d.ad.sa.d> writes:
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
Jan 13 2010
parent reply BCS <none anon.com> writes:
Hello bobef,

 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.
 
Sounds like a static array is getting incorrectly marked as containing pointers. I think it would be valid to say that the data from an import(filename) NEVER contains pointers.
Jan 13 2010
parent reply bobef <aasd.aasdasd.asd.ad.ad.as.d.a asdasdas.das.da.d.ad.sa.d> writes:
BCS Wrote:

 
 Sounds like a static array is getting incorrectly marked as containing
pointers. 
 I think it would be valid to say that the data from an import(filename) NEVER 
 contains pointers. 
 
 
Thank you for the clue. So if this is the case maybe the problem is the GC, not dmd?
Jan 13 2010
parent bobef <aasd.aasdasd.asd.ad.ad.as.d.a asdasdas.das.da.d.ad.sa.d> writes:
I can confirm the bugs with dmd 1.055 and tango trunk. I would appreciate ideas
how to reproduce them. Thanks.
Jan 13 2010