wolftousen wrote:
I have a function defined as:
some_function(int[] array) { ... }; //this function does not ever modify
values of array
When I call this function (once every program cycle) from an object using an
array of type short:
//member variable in an object
short[] x = new short[4];
//object calls this
some_function([ x[0], x[1], x[2], x[3] ]);
After a few seconds of the program running, x[0] and x[1] values are set to 0
and a couple values of another array in the object are modified as well.
I have found that this bug is corrected by calling delete at the end of
some_function of the variable array. This tells me that the garbage collector
is acting funny if I do not call delete on the array. (I have watched the
memory usage of the program and it doesn't fluctuate or pause or anything to
signal the freeing/allocating of memory....)
Any Idea what is going on?
Can you use obj2asm and post the assembly of both functions? I'm
guessing DMD is doing some kind of weird optimization with the array
literal allocation.