Symbian
Symbian OS Library

FAQ-0829 Why can't I create and destroy more than ~2000 threads on the emulator.

[Index][spacer] [Previous] [Next]



 

Classification: General Category: Emulator
Created: 10/28/2002 Modified: 04/14/2003
Number: FAQ-0829
Platform: Not Applicable

Question:
I have tests which run overnight which involve creating and exiting threads. However sometimes after a few thousand have been created, the tests fails with KErrGeneral from RThread::Create().

Answer:
There is a problem with the underlying PC emulation of threads. When a thread is terminated under Symbian OS, the thread has exited and freed it's memory, but the underlying Windows thread cannot free it's resources until the emulator process exits.
    After a few thousand threads have been created and destroyed, the resources mount up so that there is no space left to create a new thread and the emulator becomes useless and needs restarting.

    Apparent Memory Leak
    This behaviour can be seen when opening and closing an application. The memory footprint of the emulator keeps going up each time the app is terminated and closed.

    Solution
    There is no current solution for 7.0 and precursors, it is a limitation of the emulator.
    The problem does not show up on hardware.