There are no memory leaks in the J interpreter.
(Never has from day 0.)  Checkpoints are placed
in various places so that memory use is snapshot
on entry into a module and restored on exit
(except for those marked as "permanent" by things
such as the copula).  In particular, there is
an overall checkpoint on the top-level immediate 
execution module.

What happen in this case is that you used a lot
of small memory blocks, as indicated by 
   7!:3''
  64 29644938
 128     1293
 256      342
 512      270
1024       84

That is, there were about 30 million blocks of
size 64 bytes (= 1.9 G).  The routine to free 
up these memory blocks itself got an "out of 
memory" error and was not able to do its work.  
I'll fix this for the next release.



----- Original Message -----
From: Don Guinn <[EMAIL PROTECTED]>
Date: Friday, March 23, 2007 7:34 am
Subject: [Jprogramming] Out of Memory

> What follows is the entire contents of a J session which ran out 
> of memory.
> This is on a 1G machine on Windows XP Pro.
> 
> I was playing with one of the Project Euler problems and wanted to 
> verifythe answer using rationals instead of floats. The solution 
> using floats ran
> in about a second. When I converted it to use rationals it went to 
> pagingand eventually ran out of memory. Fair enough. This is a 
> pretty memory
> intensive approach.
> 
> The problem is that once it ran out of memory nothing of any 
> consequenceworked. Even clicking File/Exit got out of memory. 
> Fortunately 7!:3''
> worked, but it took a long time to run as it had to go through a 
> lot of
> memory that was paged.
> 
> The thing is that there should be plenty of memory available as 
> nothingbeyond the standard libraries were loaded. Is there a 
> memory leak somewhere?
> Is it possible that when an out of memory occurs that J forgets to 
> free up
> memory? This is on j601/2006-11-17/17:05
> 
>   x:(x:^:_1]3r7)(_2:{[:(/:~)[:~.]%~[:<.*)>:i.100000
> 42857r100000
>   x:(x:^:_1]3r7)(_2:{[:(/:~)[:~.]%~[:<.*)>:i.1000000
> 428570r999997
>   x:(x:^:_1]3r7)(_2:{[:(/:~)[:~.]%~[:<.*)>: i.1000000
> 428570r999997
>   3r7(_2:{[:(/:~)[:~.]%~[:<.*)>:i.1000000
> |out of memory
> |       (_2:{[:(/:~)[:~.]%~[:<.*)>:i.1000000
>   x:(x:^:_1]3r7)(_2:{[:(/:~)[:~.]%~[:<.*)>:i.1000000
> |out of memory
> |   x:(x:^:_1]3r7)    (_2:{[:(/:~)[:~.]%~[:<.*)>:i.1000000
> 
> |out of memory: wdhandler_0_
> |   wdq=:    wd'q'
> 
> |out of memory: wdhandler_0_
> |   wdq=:    wd'q'
> 
> |out of memory: wdhandler_0_
> |   wdq=:    wd'q'
> 
> |out of memory: wdhandler_0_
> |   wdq=:    wd'q'
> 
> |out of memory: wdhandler_0_
> |   wdq=:    wd'q'
>   7!:3''
>  64 29644938
> 128     1293
> 256      342
> 512      270
> 1024       84
> 
> |out of memory: wdhandler_0_
> |   wdq=:    wd'q'
> 
> -------At this point after I copied the session to the clipboard 
> for pasting
> into this message I entered 2!:55'' and ended the session.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to