>Just like to know if anyone has noticed any memory issues while using
>qsort. I'm sorting large arrays in a loop and deleting variables along the
>way to save memory but it seems that everytime qsort is called, temp
>variables are created and then not deleted(that's my diagnosis anyway).
>Run this test program and top. It eventually sucks up my machine memory:
> do i = 0,200
> x1D = new((/4000000/),integer)
> x1D = 1
> end do
>Also, I think the example on qsort is incorrect. 'qsort_x = qsort(x)' will
yes ... the documentation is incorrect.
qsort is a procedure not a function.
I have fixed that. [do a reload on the above page]
It should be:
x = (/4.3, 0.9, 5.2, 7.7, 2.3, -4.7, -9.1/)
THX for the 'heads-up'
----  I copied your code and ran the following on several of our machines. [SGI: 64GB memory], [linux: 8GB and 2GB], [Solaris: ?1GB or 2 GB]
%>ncl testQ.ncl Copyright (C) 1995-2004 - All Rights Reserved University Corporation for Atmospheric Research NCAR Command Language Version 4.2.0.a032 The use of this software is governed by a License Agreement. See http://ngwww.ucar.edu/ncl/ for more details. (0) 0 (0) 1 (0) 2 (0) 3 (0) 4 (0) 5 (0) 6 (0) 7 (0) 8 (0) 9 [I stopped it here]
I also tried some large vectors on a large memory machine:
/home/tempest/shea>ncl ncl 0> N = 10000000 ncl 1> x = random_uniform(-10,10,N) ncl 2> qsort(x) ncl 3> N = 50000000 ; this is *slow* but works ncl 4> y = random_uniform(-10,10,N) ncl 5> qsort(y) ncl 6> quit
Not fast but no memory error.
What OS [uname -a] and how much memory do you have available?
do i = 0,200 print((/i/)) x1D = new((/4000000/),integer) x1D = 1 qsort(x1D) delete(x1D) ; *no* need to do this here because ; the size/type does not change with ; each iteration end do
--- I suspect that the above is a sample for debug but the best way would be
x1D = new((/4000000/),integer) ; one memory allocation
do i = 0,200 print((/i/)) ; or print("i="+i) x1D = 1 ; all 1 qsort(x1D) ; obviously no need in this trivial case end do
_______________________________________________ ncl-talk mailing list email@example.com http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Mon Jun 20 2005 - 08:43:13 MDT