Unable to allocate memory: to make array.

100 views
Skip to first unread message

d.p...@gmail.com

unread,
Nov 28, 2022, 1:04:09 AM11/28/22
to idl-pvwave
Folks, 
I need help on "Unable to allocate memory: to make array." After reading the data from *.h5 data, I am getting this  "Unable to allocate memory: to make array." error. Sometimes it is working; I mean without error, but most of the time I am getting the error...
My code is like this:

s = h5_parse(file)
fileID = h5f_open(file)
i_HH = h5d_open(fileID, '/bands/i_HH')
i_HV = h5d_open(fileID, '/bands/i_HV')
i_VV = h5d_open(fileID, '/bands/i_VV')
q_HH = h5d_open(fileID, '/bands/q_HH')
q_HV = h5d_open(fileID, '/bands/q_HV')
q_VV = h5d_open(fileID, '/bands/q_VV')
incident = h5d_open(fileID, '/tie_point_grids/incident_angle')
lat = h5d_open(fileID, '/tie_point_grids/latitude')
lon = h5d_open(fileID, '/tie_point_grids/longitude')
;+++++++++++++++++++++++++++++++++++++++
i_HH = h5d_read(i_HH)
i_HV = h5d_read(i_HV)
i_VV = h5d_read(i_VV)
q_HH = h5d_read(q_HH)
q_HV = h5d_read(q_HV)
q_VV = h5d_read(q_VV)
 
incident = h5d_read(incident)
lat = h5d_read(lat)
lon = h5d_read(lon)
range_spacing = s.(8).(6).range_spacing.(3)
azimuth_spacing = s.(8).(6).azimuth_spacing.(3)
H5F_CLOSE, fileID                                  ; Close all
;print, range_spacing, azimuth_spacing
;+++++++++++++++++++++++++++++++++++++++reading is finished
dims=size(i_HH, /DIMENSIONS)

hh_slc_geo = i_HH + complex(0,1)*q_HH
DELVAR, i_HH, q_HH
hv_slc_geo = i_HV + complex(0,1)*q_HV
DELVAR, i_HV, q_HV
vv_slc_geo = i_VV + complex(0,1)*q_VV
DELVAR, i_VV, q_VV
Any kind of the help is highly appreciated, 
Cheers, 
Dave

Ben C

unread,
Nov 28, 2022, 6:37:13 AM11/28/22
to idl-pvwave
Try using TEMPORARY function in some places? 

d.p...@gmail.com

unread,
Nov 28, 2022, 6:57:31 AM11/28/22
to idl-pvwave
Never used that before; I do not know how it is working...

Chris Torrence

unread,
Nov 30, 2022, 7:17:55 PM11/30/22
to idl-pvwave
It sounds like your system is just running out of memory. You're probably right on the edge, which is why it works sometimes and not others. You can use "help,/memory" to get an idea of how much memory IDL is currently using. Also, it looks like you are doing some intermediate processing of your arrays. You might want to move those equations up into your read code, and then immediately free those variables before trying to read more. For example:
...
i_HH = h5d_read(i_HH)
q_HH = h5d_read(q_HH)
hh_slc_geo = complex(temporary(i_HH), temporary(q_HH))
i_HV = h5d_read(i_HV)
q_HV = h5d_read(q_HV)
 hh_slc_geo = complex(temporary(i_HV), temporary(q_HV))
i_VV = h5d_read(i_VV)
q_VV = h5d_read(q_VV)
 hh_slc_geo = complex(temporary(i_VV), temporary(q_VV))
...

Hope this helps!
Cheers,
Chris
Reply all
Reply to author
Forward
0 new messages