[python-win32] 1MB Thread Stack Size

Mark Hammond mhammond at skippinet.com.au
Thu Jun 2 03:44:24 CEST 2005


win32process.beginthreadex allows you to specify the size.  However there is
almost certainly a better way of doing what you want than creating that many
threads, generally using non-blocking operations and an IO Completion Port
- what exactly are you doing?
 
I believe the "stackless" prject is all but dead - but that offered
"micro-threads" for cases where a huge number of threads were desired and
hard to avoid.
 
Mark

-----Original Message-----
From: python-win32-bounces at python.org
[mailto:python-win32-bounces at python.org]On Behalf Of Hughes, Chad O
Sent: Thursday, 2 June 2005 10:26 AM
To: python-win32 at python.org
Subject: [python-win32] 1MB Thread Stack Size



I have a program that needs to create a great deal of threads.
Unfortunately, I cannot seem to find a way to lower the 1MB default stack
size per thread.  The threading module does not seem to support setting the
stack size explicitly.  I have 1GB of memory on my system so I can only
create about 1000 threads before I receive the following error trace:

  File "C:\Python24\lib\threading.py", line 442, in __bootstrap 
    self.run() 
  File "C:\Python24\lib\threading.py", line 422, in run 
    self.__target(*self.__args, **self.__kwargs) 
  File "C:\tagent\globalModule.py", line 190, in shell 
    self.target() 
  File "C:\tagent\agent.py", line 132, in runLoop 
    self.timeSliceEvent(currentTime,delta) 
  File "C:\tagent\agent.py", line 397, in timeSliceEvent 
    actorInstance.threadStart() 
  File "C:\tagent\agent.py", line 117, in threadStart 
    threading.Thread.start(self) 
  File "C:\Python24\lib\threading.py", line 416, in start 
    _start_new_thread(self.__bootstrap, ()) 
  error: can't start new thread 

Any ideas on how to lower the stack size? 

Chad 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4504 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-win32/attachments/20050602/fd8210fb/winmail-0001.bin


More information about the Python-win32 mailing list