Maybe I am doing something wrong, because the difference of memory when I use instances is huge.
Yes but your metric is not meaningful. The renderer is a separate entity form the rest of the software. From its point of view it doesnt matter but for rest of maya it obviously does. The renderer doesnt really need the bulk of the data. Instansing helps maya but not necceserily the rendering engine. Since maya software is bundled in with maya you can not separate the 2 form each other by looking into the memory requirement.
Thing is your starting cost is higher but the renderer will consequently need to expand it all into nonistantiated form during render time when it needs the data! It may successfully flush this data away once its done with the current bucket, but it may need to keep it for for instance raytracing purposes.
So you starting cost with a copy higher but that cost has to be paid at some point by the renderer. So if you can not get the copies to fit memory then theres a RISK that your not going to be able to get things rendered for this reason.
So you will eventally either pay it in speed or in memory requitrement OR BOTH.
I am running on a 64 bit system.
Well yes ist a bit uninformative to say your on a 64 bit system since now I dont know if your maya is 64 bit on a 64 bit system or a 32 bit maya on 64 bit system.
But assuming your doing the sane thing then buy more memory. Its cheaper than trying bash your head against the wall. Seriously each hour of you trying to rationalize literary buys a lot of memory.
So for a rough calculation if you get paid a quite lowish figure of 15$ and hour yoru net worth after all other costs to the comppany is 3-6 times that lets say 3 thats 45$ per hour that literary buys you 2 GIGABYTES of memory.
Obviously once you hit your motherboards cap its a anoyther thing entirely.
Yes, I am using a standalone application writting in Python to render the scene.
I use the 'Maya Python API' and the 'cmds' module.
Ah... well in that case you may want to consider turning undo off before you start operating, or flush it before you enter render. May save you some memory. You should also delete your python environment once youve finished populating.
cmds.connectAttr(neuronMorphologies['oldMesh.outMesh','newMesh.inMesh',force=True)
No this creates a copy. it just shares the inputs its still a copy for all intents and purposes. It saves some memory as long as teh tweaks are off. But no its not a instance no.
use:
cmds.duplicate( 'object', ilf=True )