Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000227ILNumerics[All Projects] Please Check!public2016-03-24 11:292016-03-24 11:32
Assigned Toho 
PlatformOSOS Version
Summary0000227: Inefficient memory management on large arrays in binary operations and in loops
DescriptionThe following code was expected to consume only two array storages. But it seems that a new storage is allocated in each loop iteration. vArray.a = ... does not free the storage but keeps them alive until GC kicks in:

Sub Main()
Using ILScope.Enter
Dim vArray As ILArray(Of Double) = ILMath.rand(10000000)

        For i As Integer = 1 To 100
            vArray.a = ILMath.add(vArray, vArray)
            ' ...
    End Using
End Sub
Steps To ReproduceRund the above code. Monitor memory allocation / usage.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
ho (administrator)
2016-03-24 11:32

fixed in 4.10. The problem was the way binary infix operators were defined on the generic ILArray<T> objects. The generic operator definition required an additional (lazy) copy of the original input parameters. This increased the internal reference counter on the input array, which in turn prevented the array from being freed into the pool during assignment.

We fixed it by redefining the binary operators in the internal layer, circumventing the explicit function types and falling back to the base arrays.

Now, the memory menagement works as expected - even in this special case.

- Issue History
Date Modified Username Field Change
2016-03-24 11:29 ho New Issue
2016-03-24 11:29 ho Status new => assigned
2016-03-24 11:29 ho Assigned To => ho
2016-03-24 11:32 ho Note Added: 0000234
2016-03-24 11:32 ho Status assigned => resolved
2016-03-24 11:32 ho Resolution open => fixed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker