memory management and pointers
- To: mathgroup at smc.vnet.net
 - Subject: [mg27147] memory management and pointers
 - From: Sebastien.deMentendeHorne at electrabel.com
 - Date: Thu, 8 Feb 2001 04:40:38 -0500 (EST)
 - Sender: owner-wri-mathgroup at wolfram.com
 
Hi,
I never heard about pointers in Mathematica but I am facing a problem where
it should be nice if Mathematica doesn't allow/free memory every time.
For instance:
u = ReplacePart[u,1,{1,1}] where u is a very big matrix
As I need to do this very often in an algorithm, Mathematica spends a lot of
the time by:
	- creating the new object ReplacePart[u,1,{1,1}] which is as big as
u
	- rebinding u to the new object
	- freeing the old u object
Is it possible to ask Mathematica to do a ReplacePart directly on u without
all the hassle of allocation/free of memory.
Another example:
 u = u + f[u] +g[u] where u is again the big matrix
will imply a lot of wasted time in memory problems.
When Mathematica says that "u += a" is equivalent to "u = u + a" is it true
or almost true (difference in memory management)?
Thank you very much
Sébastien
Sébastien de Menten de Horne      |    ELECTRABEL
Tel:  ++32 10 48 51 76            |    R&D Energy Markets, 
Fax:  ++32 10 48 51 09            |    Traverse d'Esope, 6
Gsm:  ++32 478 789 444            |    B-1348 Louvain-la-Neuve, BELGIUM