473,568 Members | 2,962 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory error while saving dictionary using pickle

I am trying to save a dictionary of size 65000X50 to a local file and
I get the memory error problem.

How do I go about resolving this? Is there way to partition the pickle
object and combine later if this is a problem due to limited resources
(memory) on the machine (it is 32 bit machine Win XP, with 4GB RAM).

Please advice.

Thank you,
Nagu

Here is the detail description of the error:

Traceback (most recent call last):
File "<pyshell#1 2>", line 1, in <module>
s = pickle.dumps(it emsim)
File "C:\Python25\li b\pickle.py", line 1366, in dumps
Pickler(file, protocol).dump( obj)
File "C:\Python25\li b\pickle.py", line 224, in dump
self.save(obj)
File "C:\Python25\li b\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python25\li b\pickle.py", line 649, in save_dict
self._batch_set items(obj.iteri tems())
File "C:\Python25\li b\pickle.py", line 663, in _batch_setitems
save(v)
File "C:\Python25\li b\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python25\li b\pickle.py", line 600, in save_list
self._batch_app ends(iter(obj))
File "C:\Python25\li b\pickle.py", line 615, in _batch_appends
save(x)
File "C:\Python25\li b\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python25\li b\pickle.py", line 562, in save_tuple
save(element)
File "C:\Python25\li b\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python25\li b\pickle.py", line 477, in save_float
self.write(FLOA T + repr(obj) + '\n')
MemoryError: out of memory
Jul 7 '08 #1
0 1716

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1353
by: Darren Dale | last post by:
If I am working interactively with 10 variables and wanted to pickle them and reload them tomorrow using the same variable names, would there be a direct way of doing it? Thanks, Darren
6
37211
by: Byron | last post by:
Hello, I am a newbie and would like to know if it is possible to convert a string back to a dictionary? For example, I can convert a dictionary to a string by doing this: >>> names = {"Candy" : 2.95, "Popcorn" : 4.95} >>> strNames = str(names) >>> print strNames
10
6946
by: Luis P. Mendes | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, my program builds a dictionary that I would like to save in a file. My question is what are the simple ways to do it? The first solution I've thought of is to transform the dictionary in a
4
5440
by: Jacob H | last post by:
Hello list... I'm developing an adventure game in Python (which of course is lots of fun). One of the features is the ability to save games and restore the saves later. I'm using the pickle module to implement this. Capturing current program state and neatly replacing it later is proving to be trickier than I first imagined, so I'm here to...
1
2906
by: DJTB | last post by:
zodb-dev@zope.org] Hi, I'm having problems storing large amounts of objects in a ZODB. After committing changes to the database, elements are not cleared from memory. Since the number of objects I'd like to store in the ZODB is too large to fit in RAM, my program gets killed with signal 11 or signal 9... Below a minimal working (or...
0
1012
by: Enrique Palomo Jiménez | last post by:
On friday i wrote a this message: I'm writing an application who needs to handle a lot of information of several files. So, i think the better way is design a batch process to catch that information in a dictionary and write it in a file. So, after that when a user wants to retrieve something, only with an execfile i'll have all the...
2
4497
by: Nagu | last post by:
I am trying to save a dictionary of size 65000X50 to a local file and I get the memory error problem. How do I go about resolving this? Is there way to partition the pickle object and combine later if this is a problem due to limited resources (memory) on the machine (it is 32 bit machine Win XP, with 4GB RAM). Here is the detail...
1
6257
by: Nagu | last post by:
I didn't have the problem with dumping as a string. When I tried to save this object to a file, memory error pops up. I am sorry for the mention of size for a dictionary. What I meant by 65000X50 is that it has 65000 keys and each key has a list of 50 tuples. I was able to save a dictionary object with 65000 keys and a list of 15-tuple...
3
6322
by: Catherine Moroney | last post by:
I'm writing a python program that reads in a very large "pickled" file (consisting of one large dictionary and one small one), and parses the results out to several binary and hdf files. The program works fine, but the memory load is huge. The size of the pickle file on disk is about 900 Meg so I would theoretically expect my program to...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.