comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Allocating memory in LINKIMAGE program
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: allocating memory [message #56422 is a reply to message #56354] Sat, 20 October 2007 01:14 Go to previous messageGo to previous message
Andrew Cool is currently offline  Andrew Cool
Messages: 219
Registered: January 1996
Senior Member
On Oct 19, 12:37 am, "R.G. Stockwell" <noem...@please.com> wrote:
> <jtmcah...@gmail.com> wrote in message
>
> news:1192673434.544923.139390@i38g2000prf.googlegroups.com.. .
>
>> So, I have this large model file that I need to open. Although it is
>> 650MB I should be able to open it in IDL on my pc computer which has
>> ~4GB of Memory. However, it keeps telling me insufficient memory.
>> However, if I try to open it in IDL on a linux machine with ~2GB
>> memory I can open it no problem. Is there a way to make my windows
>> based pc cooperate and allow me to open this file that should be no
>> problem to open?
>
>> Thanks,
>> Hawaiianite
>
> I've attached a short program memtest.pro below. I grabbed this
> off the newsgroup.
>
> It shows you the memory sizes you can allocate.
>
> The problem may be fragmentation of your ram by the many
> dlls loaded by windows and other programs. I'd remove everything
> you can from the startup (and other automatically loading programs)
> and reboot (remove spyware, antivirus, firewalls, mail programs, but
> be careful not to forget to turn them back on). That may help.
>
> pro memtest
> compile_opt idl2 ; set default integers to 32-bit and enforce [] for
> indexing
>
> MB = long64(2)^20
> currentBlockSize = MB * 2047 ; 2 GB
>
> print,'current block size = ',currentblocksize
> maxIterations = 10 ; Max loop iterations
> memPtrs = ptrarr(maxIterations)
> memBlockSizes = ulonarr(maxIterations)
>
> for i=0, maxIterations-1 do begin
> ; Error handler
> catch, err
>
> ; Sepcifically designed for "Failure to allocate memory..." error
> if (err ne 0) then begin
> currentBlockSize = currentBlockSize - MB ; ...try 1 MB smaller
> allocation
> if (currentBlockSize lt MB) then break ; Give up, if currentBlockSize
> < 1 MB
> endif
>
> ; This 'wait' enables Ctrl-Break to interrupt if necessary (Windows).
> wait, 0.0001
>
> ; Allocate memory (if possible)
> memPtrs[i] = ptr_new(bytarr(currentBlockSize, /nozero), /no_copy)
> memBlockSizes[i] = currentBlockSize ; Store the latest successful
> allocation size
>
> ; Print the current allocated block size and the running total, in Mb
> print, format='(%"Memory block #%2d: %6d Mb (total: %4d Mb)")', $
> i + 1, ishft(currentBlockSize, -20),
> ishft(ulong(total(memBlockSizes)), -20)
> endfor
>
> ptr_free,memPtrs
> end

Hmm, Here's what I get on my 4GB of RAM Quad core system running 64
bit IDL (v6.4) under 64 bit Vista :-

IDL> memtest
current block size = 2146435072
Memory block # 1: 2047 Mb (total: 2047 Mb)
Memory block # 2: 2047 Mb (total: 4094 Mb)
Memory block # 3: 2047 Mb (total: 2045 Mb)
Memory block # 4: 2045 Mb (total: 4090 Mb)
Memory block # 5: 2043 Mb (total: 2037 Mb)
Memory block # 6: 2041 Mb (total: 4078 Mb)
Memory block # 7: 1803 Mb (total: 1785 Mb)

Can't say I know how to interpret that at all !!

Andrew C.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using IDL from a perl script
Next Topic: Lonlat2reg.pro vs. Grid program

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:37:00 PDT 2025

Total time taken to generate the page: 0.00476 seconds