Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66337
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'def': 0.12; 'wrote': 0.14; 'itself.': 0.14; 'nick': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:item': 0.16; 'skip:# 20': 0.16; 'subject:] ': 0.20; 'header:X-Complaints-To:1': 0.27; '[1]': 0.29; 'please.': 0.31; 'skip:# 10': 0.33; 'problem': 0.35; 'yield': 0.36; 'to:addr :python-list': 0.38; 'subject:[': 0.39; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; '20,': 0.68; 'skip:r 40': 0.68; 'received:myvzw.com': 0.84; 'sizes:': 0.84; 'subject::': 0.85 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dave Angel <davea@davea.name> |
| Subject | Re:Generator using item[n-1] + item[n] memory |
| Date | Fri, 14 Feb 2014 18:03:21 -0500 (EST) |
| Organization | news.gmane.org |
| References | <CAHkxivc-mMfCNU3=hgk72-0pQ98rgcf0-iSMd-Y-m0pf93Dcww@mail.gmail.com> |
| X-Gmane-NNTP-Posting-Host | 110.sub-70-208-165.myvzw.com |
| X-Newsreader | PiaoHong Usenet NewsReaders 1.36 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6942.1392418793.18130.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1392418793 news.xs4all.nl 2877 [2001:888:2000:d::a6]:56539 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:66337 |
Show key headers only | View raw
Nick Timkovich <prometheus235@gmail.com> Wrote in message:
>
def biggen():
sizes = 1, 1, 10, 1, 1, 10, 10, 1, 1, 10, 10, 20, 1, 1, 20,
20, 1, 1
for size in sizes:
data = [1] * int(size * 1e6)
#time.sleep(1)
yield data
> def consumer():
for data in biggen():
rusage = resource.getrusage(resource.RUSAGE_SELF)
peak_mb = rusage.ru_maxrss/1024.0
print('Peak: {0:6.1f} MB, Data Len: {1:6.1f} M'.format(
peak_mb, len(data)/1e6))
#print(memory_usage())
data = None # go
del data # away
gc.collect() # please.
............
I think one problem is in the generator itself. After the yield,
set data=None
--
DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re:Generator using item[n-1] + item[n] memory Dave Angel <davea@davea.name> - 2014-02-14 18:03 -0500
csiph-web