I am running a script which extracts the information from debian packages and saves it in a database.
After extracting information from about 100 packages an error
You're using a 32bit system and running out of virtual memory. One of your libraries is likely spawning threads and not reclaiming them correctly. As a workaround, try reducing the default thread stack size with threading.stack_size.