[Jprogramming] Out of Memory

Don Guinn donguinn at pvtn.net
Fri Mar 23 22:34:14 HKT 2007


 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 verify
the 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 paging
and 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 consequence
worked. 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 nothing
beyond 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.


More information about the Programming mailing list