About memory issues...

From: Victor Torres <vtpuente_at_nyahnyahspammersnyahnyah>
Date: Sun Aug 05 2012 - 22:02:53 MDT

Hi there!
   I'm using the function random_uniform inside a do loop, however
when I execute it a second, third and n - time it always returns the
same values, here it is the script and the results:

;*******************************************************************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
do i = 1, 5
X = (/-2.41, 4.86, 6.06, 9.11, 10.2, 12.81, 13.17, 14.1, 15.77, 15.79/)
a = round(random_uniform(0,dimsizes(X)-1,dimsizes(X)),3)
print(a)
delete(a)
end do

end
;********************************************************************************************************

The results are:

victor@orange:~/Desktop/pre$ ncl randum.ncl
 Copyright (C) 1995-2011 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.0.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 3
(1) 3
(2) 4
(3) 3
(4) 3
(5) 1
(6) 5
(7) 7
(8) 3
(9) 3

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 8
(1) 3
(2) 3
(3) 5
(4) 7
(5) 0
(6) 0
(7) 3
(8) 1
(9) 7

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 3
(1) 2
(2) 1
(3) 1
(4) 6
(5) 4
(6) 7
(7) 6
(8) 4
(9) 8

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 4
(1) 0
(2) 8
(3) 7
(4) 3
(5) 4
(6) 7
(7) 0
(8) 1
(9) 1

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 8
(1) 3
(2) 4
(3) 7
(4) 2
(5) 7
(6) 3
(7) 8
(8) 6
(9) 4
victor@orange:~/Desktop/pre$
victor@orange:~/Desktop/pre$ ncl randum.ncl
 Copyright (C) 1995-2011 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.0.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 3
(1) 3
(2) 4
(3) 3
(4) 3
(5) 1
(6) 5
(7) 7
(8) 3
(9) 3

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 8
(1) 3
(2) 3
(3) 5
(4) 7
(5) 0
(6) 0
(7) 3
(8) 1
(9) 7

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 3
(1) 2
(2) 1
(3) 1
(4) 6
(5) 4
(6) 7
(7) 6
(8) 4
(9) 8

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 4
(1) 0
(2) 8
(3) 7
(4) 3
(5) 4
(6) 7
(7) 0
(8) 1
(9) 1

Variable: a
Type: integer
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes: [10]
Coordinates:
(0) 8
(1) 3
(2) 4
(3) 7
(4) 2
(5) 7
(6) 3
(7) 8
(8) 6
(9) 4
victor@orange:~/Desktop/pre$

And so on...

It seems that the memory allocation is the same, does anybody knows
how to clean this memory allocation from ncl???

Thank you very much
Regards

Victor Torres
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Aug 5 22:03:02 2012

This archive was generated by hypermail 2.1.8 : Wed Aug 15 2012 - 08:12:08 MDT