dictionary - Python shelve OutOfMemory error -


I have some data stored in the DB that I want to process. DB access pain is slow, so I decided to load all the data in a dictionary before any processing. However, due to the huge size of the stored data, I get out of memory error (I use more than 2 gigas). So I decided to use the disk data structure and found out that using stell is an option. Def load data (if: #dict on disk): d = shelve.open (name) returns d and: d = shelve.open (name, write = tru) # write data db and data # d [key] = Value # for unstable values ​​or # old current = D [key] #newwalk = F (oldw) #d [key] = newwale d. I have a few questions,

1) Do I really need to write? (Score: 4, = That's true? What does this do?

2) I still get an outflow-memory exception, as long as the data is being written on disk, I have no control Does How do I do that? I tried to do a sync () every few iterations, but he did not help either.

Thank you!

writeback = true any item is ever received on the shelf , And forcing the shelf to write them back when the shelf is closed, so it consumes more memory, and slows down the closing.

The advantage of the parameter is that, with this, you do not do not enterend (23)

your contract code ( If works (will only write

  shelf ['foobar']. The shelf  was enabled with backup enabled), assuming the key  'foobar'  is a list of courses, while it will quietly have an operation (leaving items on disk unchanged), if  shelf  was opened without writing - in the latter case your The code is actually required 

  thelist = shelf ['foobar'] thelist.append (23) shake ['phobar'] = in the list  

In the spirit of your comment - which is somewhat stylishly bomber.

However, since you are having a memory problem, I would definitely like this suspicious writing option I recommend using no . I think I can call it "suspicious" because I wanted the preamble and it was first implemented Was supposed to be, but it was many years ago, and I have mostly regretted doing it - it is more common than the confusion (as much as your q-proofs), originally written to work with dialing The code allows elegance and harmony in walking (which will first use the idioms, the second will not be, and thus will require reconstruction so that without the traceback alma Experiment with Ion could be). Ah well, sorry, done is a good idea at that time.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -