COM Server crashing when returning large arrays

Stefan Schukat SSchukat at
Tue May 23 13:16:12 CEST 2006

Hello Alistair, 

which version of pythoncom you are using? In the newer versions there is
an support
for a "native" safearray (the data type Excel is providing). In older
versions the complete
array was converted to a tuple which is very time and memory consuming.
during this
conversion you could run out of memory since you have the Python objects
and the 
COM data in your process. I think in 207 the patch was included.


> -----Original Message-----
> From: at 
> [ at] On 
> Behalf Of Alastair Alexander
> Sent: Monday, May 22, 2006 6:27 PM
> To: python-list at
> Subject: COM Server crashing when returning large arrays
> Hi ... I'm using pythoncom to create a python COM server 
> application that needs to be able to return large arrays to 
> COM client apps. For example, I need to be able to return an 
> array to Excel that is 500 by 10, with each element of the 
> array holding a 32 byte string.
> If I run the code for smaller arrays, say 10 by 10, it works 
> fine. If I allow the server to try to return the entire 500 
> by 10 array, pythonw.exe causes a memory access violation and 
> dies and I get an "automation exception" error message in the 
> client app.
> I assume I'm violating some upper limit for data transfer 
> from pythoncom into COM. Anyone know if such limitations 
> exist? Is there a way around them? 
> Can anyone point me in the right direction?
> Thanks
> Alastair
> p.s. 1st message on comp.lang.python, indeed 1st message on 
> any news group 
> --

More information about the Python-list mailing list