[Liblas-devel] Python memory usage issue

Nicola Creati ncreati at inogs.it
Fri Jan 21 09:38:37 EST 2011


On 01/21/2011 03:36 PM, Howard Butler wrote:
> On Jan 21, 2011, at 4:07 AM, Nicola Creati wrote:
>
>> Hello,
>> running this simple Python script you will find that you will soon get  out of memory. (It works with any las files)
>> Can someone explain why?
>> Thanks,
>>
>> Nicola
>>
>>
>> from liblas.file import File
>> f = File('/Downloads/libLAS-1.6.0b3/test/data/1.1_1.las')
>> for i in xrange(15000):
>>     temp = f.header.offset
> Cache the header:
>
> f = File('/Downloads/libLAS-1.6.0b3/test/data/1.1_1.las')
> h = f.header
> for i in xrange(15000):
>      temp = h.offset
>
> As far as the reason why it runs out of memory?  Bad design :)  Putting the f.header call inside the inner loop means constructing a python header object every time.  This was leaking header objects, and has been fixed in the main branch.
>
> Thanks for the report,
>
> Howard

Hello,
thank you for the information.

Nicola

-- 
Nicola Creati
Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS www.inogs.it Dipartimento di Geofisica della Litosfera Geophysics of Lithosphere Department CARS (Cartography and Remote Sensing) Research Group http://www.inogs.it/Cars/ Borgo Grotta Gigante 42/c 34010 Sgonico - Trieste - ITALY ncreati at ogs.trieste.it
off.   +39 040 2140 213
fax.   +39 040 327307

_____________________________________________________________________
This communication, that may contain confidential and/or legally privileged information, is intended solely for the use of the intended addressees. Opinions, conclusions and other information contained in this message, that do not relate to the official business of OGS, shall be considered as not given or endorsed by it. Every opinion or advice contained in this communication is subject to the terms and conditions provided by the agreement governing the engagement with such a client. Any use, disclosure, copying or distribution of the contents of this communication by a not-intended recipient or in violation of the purposes of this communication is strictly prohibited and may be unlawful. For Italy only: Ai sensi del D.Lgs.196/2003 - "T.U. sulla Privacy" si precisa che le informazioni contenute in questo messaggio sono riservate ed a uso esclusivo del destinatario.
_____________________________________________________________________



More information about the Liblas-devel mailing list