On Tue, Dec 15, 2009 at 10:11 AM, Pinku Surana <[email protected]> wrote:
> To learn Factor, I wrote up a spelling correction program (I'd appreciate
> suggestions to improve this). I tried using some concurrency features but it
> resulted in an "Out of memory" exception and the listener died. So I had a
> few questions about this:
> 1. How do I tell the listener not to die on "Out of memory", and instead
> abort and return to the listener?
You can't -- at this point heap exhaustion is a fatal error.
> 2. This exception occurs when I replace cleave with parallel-cleave: { 4
> quots } parallel-cleave. Does parallel-cleave block until all quots return?
Yes.
> I'm assuming it does, in which case there should only be 4 extra threads in
> my program. But when I run my program on an array of 500 words (process 1 at
> a time), the image crashes.
It sounds like you have a logic bug that you'll need to debug by trial
and error.
> 3. I wanted to use "size" to check memory consumption of a vector, but it
> appears to only give me the size of the vector and not its contents too. Can
> I get the total storage size of a data structure?
You could write a word which recursively calls 'size' on nested
structures, or you can look at the output of 'gc room.' before and
after constructing the vector, without having done anything else.
> 4. Are there any plans to add multi-threading to the VM? I didn't realize
> Factor was single-threaded until i noticed it peak at 50% cpu.
This is a long term goal, yes.
Slava
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk