Here I want to suggest a feature I have wanted for so long -- copy on
Currently with the reference/copy operations, it's quite a lot of
overhead. but with copy on write, one can forget every thing about
memory management, just use Arrays like normal variables. This is so
appealing to me, and also to many others, I believe. This feature is
supported in Qt for a long time, and some other languages like Matlab
also have it.
It's not hard to implement, as far as I can see, based on the features
Blitz already have. Just a few personal suggestions for implementing:
1) using reference tracking, instead of reference counting. this
means the owner array of a data block in memory keeps record of all its
views, probably by storing their pointers in a linked list.
2) when a view is going to be written, it makes a copy of its data
(which is easily done by Blitz makeUnique function ), and then overwrite
some data, while the owner and the other views are kept untouched,
except the owner has to remove the view from its view list.
3) when an owner is going to be written, it exerts all its views to
make themselves unique, and then the owner gets written. or,
4) it looks through the view list trying to find a "complete view"
which views the whole data block. If such one is found, this view is
granted ownership, while the former owner makes unique and then its data
get modified. This technique is to reduce memory copying even more.
Hope this will help.
Get latest updates about Open Source Projects, Conferences and News.