Pharo-users
By thread
pharo-users@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
November 2014
- 71 participants
- 427 messages
Re: [Pharo-users] running out of memory while processing a 220MB csv file with NeoCSVReader - tips?
by Sven Van Caekenberghe
OK then, you *can* read/process 300MB .csv files ;-)
What does your CSV file look like, can you show a couple of lines ?
You are using a custom record class of your own, what does that look like or do ?
Maybe you can try using Array again ?
What percentage of records read do you keep ? In my example it was very small. Have you tried calculating your memory usage ?
> On 14 Nov 2014, at 22:34, Paul DeBruicker <pdebruic(a)gmail.com> wrote:
>
> Yes. With the image & vm I'm having trouble with I get an array with 9,942
> elements in it. So its works as you'd expect.
>
> While processing the CSV file the image stays at about 60MB in RAM.
>
>
>
>
>
>
>
>
>
> Sven Van Caekenberghe-2 wrote
>> Can you successfully run my example code ?
>>
>>> On 14 Nov 2014, at 22:03, Paul DeBruicker <
>
>> pdebruic@
>
>> > wrote:
>>>
>>> Hi Sven,
>>>
>>> Thanks for taking a look and testing the NeoCSVReader portion for me.
>>> You're right of course that there's something I'm doing that's slow.
>>> But.
>>> There is something I can't figure out yet.
>>>
>>> To provide a little more detail:
>>>
>>> When the 'csv reading' process completes successfully profiling shows
>>> that
>>> most of the time is spent in NeoCSVReader>>#peekChar and using
>>> NeoCSVReader>>##addField: to convert a string to a DateAndTime. Dropping
>>> the DateAndTime conversion speeds things up but doesn't stop it from
>>> running
>>> out of memory.
>>>
>>> I start the image with
>>>
>>> ./pharo-ui --memory 1000m myimage.image
>>>
>>> Splitting the CSV file helps:
>>> ~1.5MB 5,000 lines = 1.2 seconds.
>>> ~15MB 50,000 lines = 8 seconds.
>>> ~30MB 100,000 lines = 16 seconds.
>>> ~60MB 200,000 lines = 45 seconds.
>>>
>>>
>>> It seems that when the CSV file crosses ~70MB in size things start going
>>> haywire with performance, and leads to the out of memory condition. The
>>> processing never ends. Sending "kill -SIGUSR1" prints a stack primarily
>>> composed of:
>>>
>>> 0xbffc5d08 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
>>> OutOfMemory class
>>> 0xbffc5d20 M OutOfMemory class(Behavior)>basicNew 0x1f7ac060: a(n)
>>> OutOfMemory class
>>> 0xbffc5d38 M OutOfMemory class(Behavior)>new 0x1f7ac060: a(n) OutOfMemory
>>> class
>>> 0xbffc5d50 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
>>> OutOfMemory class
>>> 0xbffc5d68 M OutOfMemory class(Behavior)>basicNew 0x1f7ac060: a(n)
>>> OutOfMemory class
>>> 0xbffc5d80 M OutOfMemory class(Behavior)>new 0x1f7ac060: a(n) OutOfMemory
>>> class
>>> 0xbffc5d98 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
>>> OutOfMemory class
>>>
>>> So it seems like its trying to signal that its out of memory after its
>>> out
>>> of memory which triggers another OutOfMemory error. So that's why
>>> progress
>>> stops.
>>>
>>>
>>> ** Aside - OutOfMemory should probably be refactored to be able to signal
>>> itself without taking up more memory, triggering itself infinitely.
>>> Maybe
>>> it & its signalling morph infrastructure would be good as a singleton **
>>>
>>>
>>>
>>> I'm confused about why it runs out of memory. According to htop the
>>> image
>>> only takes up about 520-540 MB of RAM when it reaches the 'OutOfMemory'
>>> condition. This Macbook Air laptop has 4GB, and has plenty of room for
>>> the
>>> image to grow. Also I've specified a 1,000MB image size when starting.
>>> So
>>> it should have plenty of room. Is there something I should check or a
>>> flag
>>> somewhere that prevents it from growing on a Mac? This is the latest
>>> Pharo30 VM.
>>>
>>>
>>> Thanks for helping me get to the bottom of this
>>>
>>> Paul
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Sven Van Caekenberghe-2 wrote
>>>> Hi Paul,
>>>>
>>>> I think you must be doing something wrong with your class, the #do: is
>>>> implemented as streaming over the record one by one, never holding more
>>>> than one in memory.
>>>>
>>>> This is what I tried:
>>>>
>>>> 'paul.csv' asFileReference writeStreamDo: [ :file|
>>>> ZnBufferedWriteStream on: file do: [ :out |
>>>> (NeoCSVWriter on: out) in: [ :writer |
>>>> writer writeHeader: { #Number. #Color. #Integer. #Boolean}.
>>>> 1 to: 1e7 do: [ :each |
>>>> writer nextPut: { each. #(Red Green Blue) atRandom. 1e6 atRandom.
>>>> #(true false) atRandom } ] ] ] ].
>>>>
>>>> This results in a 300Mb file:
>>>>
>>>> $ ls -lah paul.csv
>>>> -rw-r--r--@ 1 sven staff 327M Nov 14 20:45 paul.csv
>>>> $ wc paul.csv
>>>> 10000001 10000001 342781577 paul.csv
>>>>
>>>> This is a selective read and collect (loads about 10K records):
>>>>
>>>> Array streamContents: [ :out |
>>>> 'paul.csv' asFileReference readStreamDo: [ :in |
>>>> (NeoCSVReader on: (ZnBufferedReadStream on: in)) in: [ :reader |
>>>> reader skipHeader; addIntegerField; addSymbolField;
>>>> addIntegerField;
>>>> addFieldConverter: [ :x | x = #true ].
>>>> reader do: [ :each | each third < 1000 ifTrue: [ out nextPut: each
>>>> ]
>>>> ] ] ] ].
>>>>
>>>> This worked fine on my MacBook Air, no memory problems. It takes a while
>>>> to parse that much data, of course.
>>>>
>>>> Sven
>>>>
>>>>> On 14 Nov 2014, at 19:08, Paul DeBruicker <
>>>
>>>> pdebruic@
>>>
>>>> > wrote:
>>>>>
>>>>> Hi -
>>>>>
>>>>> I'm processing a 9 GBs of CSV files (the biggest file is 220MB or so).
>>>>> I'm not sure if its because of the size of the files or the code I've
>>>>> written to keep track of the domain objects I'm interested in, but I'm
>>>>> getting out of memory errors & crashes in Pharo 3 on Mac with the
>>>>> latest
>>>>> VM. I haven't checked other vms.
>>>>>
>>>>> I'm going to profile my own code and attempt to split the files
>>>>> manually
>>>>> for now to see what else it could be.
>>>>>
>>>>>
>>>>> Right now I'm doing something similar to
>>>>>
>>>>> |file reader|
>>>>> file:= '/path/to/file/myfile.csv' asFileReference readStream.
>>>>> reader: NeoCSVReader on: file
>>>>>
>>>>> reader
>>>>> recordClass: MyClass;
>>>>> skipHeader;
>>>>> addField: #myField:;
>>>>> ....
>>>>>
>>>>>
>>>>> reader do:[:eachRecord | self seeIfRecordIsInterestingAndIfSoKeepIt:
>>>>> eachRecord].
>>>>> file close.
>>>>>
>>>>>
>>>>>
>>>>> Is there a facility in NeoCSVReader to read a file in batches (e.g.
>>>>> 1000
>>>>> lines at a time) or an easy way to do that ?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>> Paul
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://forum.world.st/running-out-of-memory-while-processing-a-220MB-csv-fi…
>>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>
>
>
> --
> View this message in context: http://forum.world.st/running-out-of-memory-while-processing-a-220MB-csv-fi…
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Nov. 14, 2014
Re: [Pharo-users] Problems with Roassal2 & Pharo 3.0
by Peter Uhnák
I think it doesn't have dependency on GT/Glamour because that is now part
of Pharo 4.0 core. But I see packages ConfigurationOf... GTInspector,
GTPlayground and Glamour (+Core for each of them). So you can try to load
these. Maybe playground isn't needed.
Also if you started with fresh image why not just switch to Pharo 4.0?
Peter
On Fri, Nov 14, 2014 at 10:06 PM, volkert(a)nivoba.de <volkert(a)nivoba.de>
wrote:
> Started today with a fresh download of Pharo 3.0 and installed Roassal2
> from the Configbrowser.
> Looks like Roassal now depends on the GTToolkit and other things, which
> are not correctly handled in
> the Config.
>
> What is missing here?
> What packages should be loaded?
>
> It is a bit disappointing how unstable/fragile the things are .... i see
> that you want make progress, but it is
> really hard to follow the development when not a "hardcore&fulltime" User
> ....
>
> Volkert
>
>
>
>
Nov. 14, 2014
Re: [Pharo-users] running out of memory while processing a 220MB csv file with NeoCSVReader - tips?
by Paul DeBruicker
Yes. With the image & vm I'm having trouble with I get an array with 9,942
elements in it. So its works as you'd expect.
While processing the CSV file the image stays at about 60MB in RAM.
Sven Van Caekenberghe-2 wrote
> Can you successfully run my example code ?
>
>> On 14 Nov 2014, at 22:03, Paul DeBruicker <
> pdebruic@
> > wrote:
>>
>> Hi Sven,
>>
>> Thanks for taking a look and testing the NeoCSVReader portion for me.
>> You're right of course that there's something I'm doing that's slow.
>> But.
>> There is something I can't figure out yet.
>>
>> To provide a little more detail:
>>
>> When the 'csv reading' process completes successfully profiling shows
>> that
>> most of the time is spent in NeoCSVReader>>#peekChar and using
>> NeoCSVReader>>##addField: to convert a string to a DateAndTime. Dropping
>> the DateAndTime conversion speeds things up but doesn't stop it from
>> running
>> out of memory.
>>
>> I start the image with
>>
>> ./pharo-ui --memory 1000m myimage.image
>>
>> Splitting the CSV file helps:
>> ~1.5MB 5,000 lines = 1.2 seconds.
>> ~15MB 50,000 lines = 8 seconds.
>> ~30MB 100,000 lines = 16 seconds.
>> ~60MB 200,000 lines = 45 seconds.
>>
>>
>> It seems that when the CSV file crosses ~70MB in size things start going
>> haywire with performance, and leads to the out of memory condition. The
>> processing never ends. Sending "kill -SIGUSR1" prints a stack primarily
>> composed of:
>>
>> 0xbffc5d08 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
>> OutOfMemory class
>> 0xbffc5d20 M OutOfMemory class(Behavior)>basicNew 0x1f7ac060: a(n)
>> OutOfMemory class
>> 0xbffc5d38 M OutOfMemory class(Behavior)>new 0x1f7ac060: a(n) OutOfMemory
>> class
>> 0xbffc5d50 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
>> OutOfMemory class
>> 0xbffc5d68 M OutOfMemory class(Behavior)>basicNew 0x1f7ac060: a(n)
>> OutOfMemory class
>> 0xbffc5d80 M OutOfMemory class(Behavior)>new 0x1f7ac060: a(n) OutOfMemory
>> class
>> 0xbffc5d98 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
>> OutOfMemory class
>>
>> So it seems like its trying to signal that its out of memory after its
>> out
>> of memory which triggers another OutOfMemory error. So that's why
>> progress
>> stops.
>>
>>
>> ** Aside - OutOfMemory should probably be refactored to be able to signal
>> itself without taking up more memory, triggering itself infinitely.
>> Maybe
>> it & its signalling morph infrastructure would be good as a singleton **
>>
>>
>>
>> I'm confused about why it runs out of memory. According to htop the
>> image
>> only takes up about 520-540 MB of RAM when it reaches the 'OutOfMemory'
>> condition. This Macbook Air laptop has 4GB, and has plenty of room for
>> the
>> image to grow. Also I've specified a 1,000MB image size when starting.
>> So
>> it should have plenty of room. Is there something I should check or a
>> flag
>> somewhere that prevents it from growing on a Mac? This is the latest
>> Pharo30 VM.
>>
>>
>> Thanks for helping me get to the bottom of this
>>
>> Paul
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Sven Van Caekenberghe-2 wrote
>>> Hi Paul,
>>>
>>> I think you must be doing something wrong with your class, the #do: is
>>> implemented as streaming over the record one by one, never holding more
>>> than one in memory.
>>>
>>> This is what I tried:
>>>
>>> 'paul.csv' asFileReference writeStreamDo: [ :file|
>>> ZnBufferedWriteStream on: file do: [ :out |
>>> (NeoCSVWriter on: out) in: [ :writer |
>>> writer writeHeader: { #Number. #Color. #Integer. #Boolean}.
>>> 1 to: 1e7 do: [ :each |
>>> writer nextPut: { each. #(Red Green Blue) atRandom. 1e6 atRandom.
>>> #(true false) atRandom } ] ] ] ].
>>>
>>> This results in a 300Mb file:
>>>
>>> $ ls -lah paul.csv
>>> -rw-r--r--@ 1 sven staff 327M Nov 14 20:45 paul.csv
>>> $ wc paul.csv
>>> 10000001 10000001 342781577 paul.csv
>>>
>>> This is a selective read and collect (loads about 10K records):
>>>
>>> Array streamContents: [ :out |
>>> 'paul.csv' asFileReference readStreamDo: [ :in |
>>> (NeoCSVReader on: (ZnBufferedReadStream on: in)) in: [ :reader |
>>> reader skipHeader; addIntegerField; addSymbolField;
>>> addIntegerField;
>>> addFieldConverter: [ :x | x = #true ].
>>> reader do: [ :each | each third < 1000 ifTrue: [ out nextPut: each
>>> ]
>>> ] ] ] ].
>>>
>>> This worked fine on my MacBook Air, no memory problems. It takes a while
>>> to parse that much data, of course.
>>>
>>> Sven
>>>
>>>> On 14 Nov 2014, at 19:08, Paul DeBruicker <
>>
>>> pdebruic@
>>
>>> > wrote:
>>>>
>>>> Hi -
>>>>
>>>> I'm processing a 9 GBs of CSV files (the biggest file is 220MB or so).
>>>> I'm not sure if its because of the size of the files or the code I've
>>>> written to keep track of the domain objects I'm interested in, but I'm
>>>> getting out of memory errors & crashes in Pharo 3 on Mac with the
>>>> latest
>>>> VM. I haven't checked other vms.
>>>>
>>>> I'm going to profile my own code and attempt to split the files
>>>> manually
>>>> for now to see what else it could be.
>>>>
>>>>
>>>> Right now I'm doing something similar to
>>>>
>>>> |file reader|
>>>> file:= '/path/to/file/myfile.csv' asFileReference readStream.
>>>> reader: NeoCSVReader on: file
>>>>
>>>> reader
>>>> recordClass: MyClass;
>>>> skipHeader;
>>>> addField: #myField:;
>>>> ....
>>>>
>>>>
>>>> reader do:[:eachRecord | self seeIfRecordIsInterestingAndIfSoKeepIt:
>>>> eachRecord].
>>>> file close.
>>>>
>>>>
>>>>
>>>> Is there a facility in NeoCSVReader to read a file in batches (e.g.
>>>> 1000
>>>> lines at a time) or an easy way to do that ?
>>>>
>>>>
>>>>
>>>>
>>>> Thanks
>>>>
>>>> Paul
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/running-out-of-memory-while-processing-a-220MB-csv-fi…
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
--
View this message in context: http://forum.world.st/running-out-of-memory-while-processing-a-220MB-csv-fi…
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Nov. 14, 2014
Has anyone tried compiling the Pharo VM into JS using Emscripten?
by Andy Burnett
I just saw this implementation of SQLite as a JS system, via Emscripten,
and I was curious whether something similar would be even vaguely possible
for the VM.
Cheers
Andy
á§
Nov. 14, 2014
Re: [Pharo-users] running out of memory while processing a 220MB csv file with NeoCSVReader - tips?
by Sven Van Caekenberghe
Can you successfully run my example code ?
> On 14 Nov 2014, at 22:03, Paul DeBruicker <pdebruic(a)gmail.com> wrote:
>
> Hi Sven,
>
> Thanks for taking a look and testing the NeoCSVReader portion for me.
> You're right of course that there's something I'm doing that's slow. But.
> There is something I can't figure out yet.
>
> To provide a little more detail:
>
> When the 'csv reading' process completes successfully profiling shows that
> most of the time is spent in NeoCSVReader>>#peekChar and using
> NeoCSVReader>>##addField: to convert a string to a DateAndTime. Dropping
> the DateAndTime conversion speeds things up but doesn't stop it from running
> out of memory.
>
> I start the image with
>
> ./pharo-ui --memory 1000m myimage.image
>
> Splitting the CSV file helps:
> ~1.5MB 5,000 lines = 1.2 seconds.
> ~15MB 50,000 lines = 8 seconds.
> ~30MB 100,000 lines = 16 seconds.
> ~60MB 200,000 lines = 45 seconds.
>
>
> It seems that when the CSV file crosses ~70MB in size things start going
> haywire with performance, and leads to the out of memory condition. The
> processing never ends. Sending "kill -SIGUSR1" prints a stack primarily
> composed of:
>
> 0xbffc5d08 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
> OutOfMemory class
> 0xbffc5d20 M OutOfMemory class(Behavior)>basicNew 0x1f7ac060: a(n)
> OutOfMemory class
> 0xbffc5d38 M OutOfMemory class(Behavior)>new 0x1f7ac060: a(n) OutOfMemory
> class
> 0xbffc5d50 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
> OutOfMemory class
> 0xbffc5d68 M OutOfMemory class(Behavior)>basicNew 0x1f7ac060: a(n)
> OutOfMemory class
> 0xbffc5d80 M OutOfMemory class(Behavior)>new 0x1f7ac060: a(n) OutOfMemory
> class
> 0xbffc5d98 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
> OutOfMemory class
>
> So it seems like its trying to signal that its out of memory after its out
> of memory which triggers another OutOfMemory error. So that's why progress
> stops.
>
>
> ** Aside - OutOfMemory should probably be refactored to be able to signal
> itself without taking up more memory, triggering itself infinitely. Maybe
> it & its signalling morph infrastructure would be good as a singleton **
>
>
>
> I'm confused about why it runs out of memory. According to htop the image
> only takes up about 520-540 MB of RAM when it reaches the 'OutOfMemory'
> condition. This Macbook Air laptop has 4GB, and has plenty of room for the
> image to grow. Also I've specified a 1,000MB image size when starting. So
> it should have plenty of room. Is there something I should check or a flag
> somewhere that prevents it from growing on a Mac? This is the latest
> Pharo30 VM.
>
>
> Thanks for helping me get to the bottom of this
>
> Paul
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Sven Van Caekenberghe-2 wrote
>> Hi Paul,
>>
>> I think you must be doing something wrong with your class, the #do: is
>> implemented as streaming over the record one by one, never holding more
>> than one in memory.
>>
>> This is what I tried:
>>
>> 'paul.csv' asFileReference writeStreamDo: [ :file|
>> ZnBufferedWriteStream on: file do: [ :out |
>> (NeoCSVWriter on: out) in: [ :writer |
>> writer writeHeader: { #Number. #Color. #Integer. #Boolean}.
>> 1 to: 1e7 do: [ :each |
>> writer nextPut: { each. #(Red Green Blue) atRandom. 1e6 atRandom.
>> #(true false) atRandom } ] ] ] ].
>>
>> This results in a 300Mb file:
>>
>> $ ls -lah paul.csv
>> -rw-r--r--@ 1 sven staff 327M Nov 14 20:45 paul.csv
>> $ wc paul.csv
>> 10000001 10000001 342781577 paul.csv
>>
>> This is a selective read and collect (loads about 10K records):
>>
>> Array streamContents: [ :out |
>> 'paul.csv' asFileReference readStreamDo: [ :in |
>> (NeoCSVReader on: (ZnBufferedReadStream on: in)) in: [ :reader |
>> reader skipHeader; addIntegerField; addSymbolField; addIntegerField;
>> addFieldConverter: [ :x | x = #true ].
>> reader do: [ :each | each third < 1000 ifTrue: [ out nextPut: each ]
>> ] ] ] ].
>>
>> This worked fine on my MacBook Air, no memory problems. It takes a while
>> to parse that much data, of course.
>>
>> Sven
>>
>>> On 14 Nov 2014, at 19:08, Paul DeBruicker <
>
>> pdebruic@
>
>> > wrote:
>>>
>>> Hi -
>>>
>>> I'm processing a 9 GBs of CSV files (the biggest file is 220MB or so).
>>> I'm not sure if its because of the size of the files or the code I've
>>> written to keep track of the domain objects I'm interested in, but I'm
>>> getting out of memory errors & crashes in Pharo 3 on Mac with the latest
>>> VM. I haven't checked other vms.
>>>
>>> I'm going to profile my own code and attempt to split the files manually
>>> for now to see what else it could be.
>>>
>>>
>>> Right now I'm doing something similar to
>>>
>>> |file reader|
>>> file:= '/path/to/file/myfile.csv' asFileReference readStream.
>>> reader: NeoCSVReader on: file
>>>
>>> reader
>>> recordClass: MyClass;
>>> skipHeader;
>>> addField: #myField:;
>>> ....
>>>
>>>
>>> reader do:[:eachRecord | self seeIfRecordIsInterestingAndIfSoKeepIt:
>>> eachRecord].
>>> file close.
>>>
>>>
>>>
>>> Is there a facility in NeoCSVReader to read a file in batches (e.g. 1000
>>> lines at a time) or an easy way to do that ?
>>>
>>>
>>>
>>>
>>> Thanks
>>>
>>> Paul
>
>
>
>
>
> --
> View this message in context: http://forum.world.st/running-out-of-memory-while-processing-a-220MB-csv-fi…
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Nov. 14, 2014
Problems with Roassal2 & Pharo 3.0
by volkert@nivoba.de
Started today with a fresh download of Pharo 3.0 and installed Roassal2
from the Configbrowser.
Looks like Roassal now depends on the GTToolkit and other things, which
are not correctly handled in
the Config.
What is missing here?
What packages should be loaded?
It is a bit disappointing how unstable/fragile the things are .... i see
that you want make progress, but it is
really hard to follow the development when not a "hardcore&fulltime"
User ....
Volkert
Nov. 14, 2014
Re: [Pharo-users] running out of memory while processing a 220MB csv file with NeoCSVReader - tips?
by Paul DeBruicker
Hi Sven,
Thanks for taking a look and testing the NeoCSVReader portion for me.
You're right of course that there's something I'm doing that's slow. But.
There is something I can't figure out yet.
To provide a little more detail:
When the 'csv reading' process completes successfully profiling shows that
most of the time is spent in NeoCSVReader>>#peekChar and using
NeoCSVReader>>##addField: to convert a string to a DateAndTime. Dropping
the DateAndTime conversion speeds things up but doesn't stop it from running
out of memory.
I start the image with
./pharo-ui --memory 1000m myimage.image
Splitting the CSV file helps:
~1.5MB 5,000 lines = 1.2 seconds.
~15MB 50,000 lines = 8 seconds.
~30MB 100,000 lines = 16 seconds.
~60MB 200,000 lines = 45 seconds.
It seems that when the CSV file crosses ~70MB in size things start going
haywire with performance, and leads to the out of memory condition. The
processing never ends. Sending "kill -SIGUSR1" prints a stack primarily
composed of:
0xbffc5d08 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
OutOfMemory class
0xbffc5d20 M OutOfMemory class(Behavior)>basicNew 0x1f7ac060: a(n)
OutOfMemory class
0xbffc5d38 M OutOfMemory class(Behavior)>new 0x1f7ac060: a(n) OutOfMemory
class
0xbffc5d50 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
OutOfMemory class
0xbffc5d68 M OutOfMemory class(Behavior)>basicNew 0x1f7ac060: a(n)
OutOfMemory class
0xbffc5d80 M OutOfMemory class(Behavior)>new 0x1f7ac060: a(n) OutOfMemory
class
0xbffc5d98 M OutOfMemory class(Exception class)>signal 0x1f7ac060: a(n)
OutOfMemory class
So it seems like its trying to signal that its out of memory after its out
of memory which triggers another OutOfMemory error. So that's why progress
stops.
** Aside - OutOfMemory should probably be refactored to be able to signal
itself without taking up more memory, triggering itself infinitely. Maybe
it & its signalling morph infrastructure would be good as a singleton **
I'm confused about why it runs out of memory. According to htop the image
only takes up about 520-540 MB of RAM when it reaches the 'OutOfMemory'
condition. This Macbook Air laptop has 4GB, and has plenty of room for the
image to grow. Also I've specified a 1,000MB image size when starting. So
it should have plenty of room. Is there something I should check or a flag
somewhere that prevents it from growing on a Mac? This is the latest
Pharo30 VM.
Thanks for helping me get to the bottom of this
Paul
Sven Van Caekenberghe-2 wrote
> Hi Paul,
>
> I think you must be doing something wrong with your class, the #do: is
> implemented as streaming over the record one by one, never holding more
> than one in memory.
>
> This is what I tried:
>
> 'paul.csv' asFileReference writeStreamDo: [ :file|
> ZnBufferedWriteStream on: file do: [ :out |
> (NeoCSVWriter on: out) in: [ :writer |
> writer writeHeader: { #Number. #Color. #Integer. #Boolean}.
> 1 to: 1e7 do: [ :each |
> writer nextPut: { each. #(Red Green Blue) atRandom. 1e6 atRandom.
> #(true false) atRandom } ] ] ] ].
>
> This results in a 300Mb file:
>
> $ ls -lah paul.csv
> -rw-r--r--@ 1 sven staff 327M Nov 14 20:45 paul.csv
> $ wc paul.csv
> 10000001 10000001 342781577 paul.csv
>
> This is a selective read and collect (loads about 10K records):
>
> Array streamContents: [ :out |
> 'paul.csv' asFileReference readStreamDo: [ :in |
> (NeoCSVReader on: (ZnBufferedReadStream on: in)) in: [ :reader |
> reader skipHeader; addIntegerField; addSymbolField; addIntegerField;
> addFieldConverter: [ :x | x = #true ].
> reader do: [ :each | each third < 1000 ifTrue: [ out nextPut: each ]
> ] ] ] ].
>
> This worked fine on my MacBook Air, no memory problems. It takes a while
> to parse that much data, of course.
>
> Sven
>
>> On 14 Nov 2014, at 19:08, Paul DeBruicker <
> pdebruic@
> > wrote:
>>
>> Hi -
>>
>> I'm processing a 9 GBs of CSV files (the biggest file is 220MB or so).
>> I'm not sure if its because of the size of the files or the code I've
>> written to keep track of the domain objects I'm interested in, but I'm
>> getting out of memory errors & crashes in Pharo 3 on Mac with the latest
>> VM. I haven't checked other vms.
>>
>> I'm going to profile my own code and attempt to split the files manually
>> for now to see what else it could be.
>>
>>
>> Right now I'm doing something similar to
>>
>> |file reader|
>> file:= '/path/to/file/myfile.csv' asFileReference readStream.
>> reader: NeoCSVReader on: file
>>
>> reader
>> recordClass: MyClass;
>> skipHeader;
>> addField: #myField:;
>> ....
>>
>>
>> reader do:[:eachRecord | self seeIfRecordIsInterestingAndIfSoKeepIt:
>> eachRecord].
>> file close.
>>
>>
>>
>> Is there a facility in NeoCSVReader to read a file in batches (e.g. 1000
>> lines at a time) or an easy way to do that ?
>>
>>
>>
>>
>> Thanks
>>
>> Paul
--
View this message in context: http://forum.world.st/running-out-of-memory-while-processing-a-220MB-csv-fi…
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Nov. 14, 2014
Re: [Pharo-users] running out of memory while processing a 220MB csv file with NeoCSVReader - tips?
by Sven Van Caekenberghe
Hi Paul,
I think you must be doing something wrong with your class, the #do: is implemented as streaming over the record one by one, never holding more than one in memory.
This is what I tried:
'paul.csv' asFileReference writeStreamDo: [ :file|
ZnBufferedWriteStream on: file do: [ :out |
(NeoCSVWriter on: out) in: [ :writer |
writer writeHeader: { #Number. #Color. #Integer. #Boolean}.
1 to: 1e7 do: [ :each |
writer nextPut: { each. #(Red Green Blue) atRandom. 1e6 atRandom. #(true false) atRandom } ] ] ] ].
This results in a 300Mb file:
$ ls -lah paul.csv
-rw-r--r--@ 1 sven staff 327M Nov 14 20:45 paul.csv
$ wc paul.csv
10000001 10000001 342781577 paul.csv
This is a selective read and collect (loads about 10K records):
Array streamContents: [ :out |
'paul.csv' asFileReference readStreamDo: [ :in |
(NeoCSVReader on: (ZnBufferedReadStream on: in)) in: [ :reader |
reader skipHeader; addIntegerField; addSymbolField; addIntegerField; addFieldConverter: [ :x | x = #true ].
reader do: [ :each | each third < 1000 ifTrue: [ out nextPut: each ] ] ] ] ].
This worked fine on my MacBook Air, no memory problems. It takes a while to parse that much data, of course.
Sven
> On 14 Nov 2014, at 19:08, Paul DeBruicker <pdebruic(a)gmail.com> wrote:
>
> Hi -
>
> I'm processing a 9 GBs of CSV files (the biggest file is 220MB or so). I'm not sure if its because of the size of the files or the code I've written to keep track of the domain objects I'm interested in, but I'm getting out of memory errors & crashes in Pharo 3 on Mac with the latest VM. I haven't checked other vms.
>
> I'm going to profile my own code and attempt to split the files manually for now to see what else it could be.
>
>
> Right now I'm doing something similar to
>
> |file reader|
> file:= '/path/to/file/myfile.csv' asFileReference readStream.
> reader: NeoCSVReader on: file
>
> reader
> recordClass: MyClass;
> skipHeader;
> addField: #myField:;
> ....
>
>
> reader do:[:eachRecord | self seeIfRecordIsInterestingAndIfSoKeepIt: eachRecord].
> file close.
>
>
>
> Is there a facility in NeoCSVReader to read a file in batches (e.g. 1000 lines at a time) or an easy way to do that ?
>
>
>
>
> Thanks
>
> Paul
Nov. 14, 2014
Re: [Pharo-users] Ploting all history of the commits in a Monticello repository
by Pierre CHANSON
No problems !
please if you can, let me know how's going your work with this or about any
ideas, I am interested in that kind of studies ;)
Cheers,
Pierre
2014-11-14 13:27 GMT-03:00 Offray Vladimir Luna Cárdenas <offray(a)riseup.net>
:
> Thanks a lot Pierre! that was exactly what I was looking for.
>
> Cheers,
>
> Offray
>
> El 12/11/14 a las #4, Pierre CHANSON escribió:
>
>> Hi Offray !
>>
>> from Pharo you can access the monticello repository with the following
>> code:
>> myRepository := MCSmalltalkhubRepository location: <anUrl>.
>>
>> then you can get: myRepository allVersionNames.
>>
>> Finally you can get the commits informations (message, author, date etc.)
>> using:
>> myRepository versionInfoFromVersionNamed: <aVersionName>.
>>
>> For exemple supposing you want to list all the commit date and time logs
>> from
>> your repository, result contained in a dictionary with the version names
>> as keys
>> you can execute:
>>
>> -=-=-=-=-=-=-=-=-=-=-=-=
>>
>> result:= Dictionary new.
>> repo := (MCSmalltalkhubRepository location:
>> 'http://smalltalkhub.com/mc/Offray/Ubakye/main').
>>
>> (repo allVersionNames sortedAs: [ :e | e extractNumber ]) asArray do: [
>> :v |
>> vers := repo versionInfoFromVersionNamed:v. result add: ( v -> (Array
>> with:
>> (vers date) with: (vers time)))].
>>
>> -=-=-=-=-=-=-=-=-=-=-=-=
>>
>> Cheers,
>>
>> Pierre
>>
>>
>>
>>
>>
>>
>>
>>
>> 2014-11-10 14:53 GMT-03:00 Offray Vladimir Luna Cárdenas <
>> offray(a)riseup.net
>> <mailto:offray@riseup.net>>:
>>
>> Hi,
>>
>> I don't know if the terminology is the proper one. Anyway I'm trying
>> to plot
>> a "time line" of the history of a project which is stored on [1] and
>> [2]
>> (after rebranding) and also of the commits to documentation on [3]
>> using
>> Pharo/Roassal.
>>
>> [1] http://smalltalkhub.com/#!/~__Offray/Ubakye/
>> <http://smalltalkhub.com/#!/~Offray/Ubakye/>
>> [2] http://smalltalkhub.com/#!/~__Offray/Grafoscopio/
>> <http://smalltalkhub.com/#!/~Offray/Grafoscopio/>
>> [3] http://mutabit.com/deltas/__repos.fossil/grafoscopio/__
>> timeline?n=200
>> <http://mutabit.com/deltas/repos.fossil/grafoscopio/timeline?n=200>
>>
>> Given I don't know any API of the sites, I thought it would be
>> easier by
>> scraping the data on the web pages and the using it into Roassal,
>> but after
>> testing some solutions on python, I came back to pharo to see if I
>> can made
>> everything on it, including the data collection.
>>
>> For [1] and [2] I think that is possible to send a message to
>> Monticello to
>> show all commits of a specific package (like it actually does from
>> the UI)
>> and export them with the information about date of commit for all
>> commits.
>> For [3] I'm thinking in using some combination of Zinc with Soup[4]
>> despite
>> of the lack of tutorials.
>>
>> [4] http://www.squeaksource.com/@__Y-xGMSBYZmiWQToh/GJDsBRqL
>> <http://www.squeaksource.com/@Y-xGMSBYZmiWQToh/GJDsBRqL>
>>
>> So here are my questions:
>>
>> - There is any way to say to Monticello to export all commits dates
>> and
>> times for a specific package?
>> - There is any advised scraping strategy for getting the same
>> information
>> from the web page at [3]?
>>
>> The plot I would like to do is similar to the one of the ebola
>> example at
>> [5], but using high as number of commits and x axis as dates.
>>
>> [5]
>> https://dl.dropboxusercontent.__com/u/31543901/__
>> AgileVisualization/QuickStart/__0101-QuickStart.html
>> <https://dl.dropboxusercontent.com/u/31543901/AgileVisualization/
>> QuickStart/0101-QuickStart.html>
>>
>> Any help is welcomed, as always.
>>
>> Cheers,
>>
>> Offray
>>
>>
>>
>
>
Nov. 14, 2014
running out of memory while processing a 220MB csv file with NeoCSVReader - tips?
by Paul DeBruicker
Hi -
I'm processing a 9 GBs of CSV files (the biggest file is 220MB or so). I'm not sure if its because of the size of the files or the code I've written to keep track of the domain objects I'm interested in, but I'm getting out of memory errors & crashes in Pharo 3 on Mac with the latest VM. I haven't checked other vms.
I'm going to profile my own code and attempt to split the files manually for now to see what else it could be.
Right now I'm doing something similar to
|file reader|
file:= '/path/to/file/myfile.csv' asFileReference readStream.
reader: NeoCSVReader on: file
reader
recordClass: MyClass;
skipHeader;
addField: #myField:;
....
reader do:[:eachRecord | self seeIfRecordIsInterestingAndIfSoKeepIt: eachRecord].
file close.
Is there a facility in NeoCSVReader to read a file in batches (e.g. 1000 lines at a time) or an easy way to do that ?
Thanks
Paul
Nov. 14, 2014