I don't like asking questions in forums like that, because I believe that every question was asked before me, so I just use the search. But now I feel myself a little dumb cause it's the first time I didn't find any answers.
I have a simple question based on a piece of code :
Dim demo_1, demo_2 As Variant 'declare the variables
Dim DataCollection As Collection 'declare the collection
Set DataCollection = New Collection 'define the collection
demo_1 = import_demo(1, nb_var) 'load first dataset (+250 mb of memory)
demo_2 = import_demo(2, nb_var) 'load second dataset (+250 mb of memory)
So, in total, my program uses 500 mb of memory. Now I want to fill my collection with references to this objects :
DataCollection.Add demo_1 'adding reference to a collection (+250 mb of memory Why??)
DataCollection.Add demo_2 'adding reference to a collection (+250 mb of memory Why??)
So I repeat my question : "Why the ---- ?" Sorry.
Should adding an object to a collection increase memory usage in VBA, because I'm clearly not cloning ?