RE: Out of memory

new topic     » goto parent     » topic index » view thread      » older message » newer message

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C20DB7.972B78A0
 charset=iso-8859-1

> -----Original Message-----
> From: Jacques Guy [mailto:jguy at alphalink.com.au]
> Sent: Friday, 7 June 2002 10:00
> To: EUforum
> Subject: RE: Out of memory
> 
> 
> 
> I had a similar problem recently, not memory (my data file
> was much smaller) but speed of loading. Using get() the
> file took 26 seconds to load. I thought this grossly
> wrong. So I rewrote those parts of my program, without
> get(), using "for" and "while" loops writing to disk
> and reading from disk and _never_ using recursion. It
> worked: the same file loaded in 0.33 seconds. No, not
> a typing mistake: from 26 seconds to one third of a
> second.
> 
> I was not surprised. I had had a similar experience
> several years earlier, memory that time. I was having
> a team of programmers implement a database of icons
> (they used C++). It all went along well when, one day,
> they sent me a new implementation, which barfed after
> loading just 37 icons -- and I had 64M of RAM, just
> about the maximum you could ever hope for in those
> days.  So they got a very puzzled "please explain".
> After apparently much head scratching the team leader
> explained "we have been using  heavily recursive
> structures and procedures". That was it, of course.
> They rewrote it using iteration instead of recursion
> and I ran out of icons before I ran out of memory
> again.
> 
> I haven't had a look at the source code, but I
> guess that get() is -- almost necessarily --
> implemented recursively.  It's fine for loading
> flat or shallow data, but, as experience shows,
> dreadfully inefficient for deeply embedded 
> sequences, as you obviously have.
> 

I have to agree with Jacques here. I've found that it is best to only use
getc(), gets() and occassionally get_bytes() to read disk files. And I would
never recommend get() or print() based on their speed (or lack thereof).
---------
Derek.

==================================================================
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en 
is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht 
onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en 
de afzender direct te informeren door het bericht te retourneren. 
==================================================================
The information contained in this message may be confidential 
and is intended to be exclusively for the addressee. Should you 
receive this message unintentionally, please do not use the contents 
herein and notify the sender immediately by return e-mail.


==================================================================

------_=_NextPart_000_01C20DB7.972B78A0
Content-Type: application/ms-tnef

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu