Re: The best way to keep data in RAM / object-oriented programming [message #68787 is a reply to message #68786] |
Thu, 03 December 2009 09:09   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
nata wites:
>
> My application needs a lot of RAM so I have to improve a solution in
> order to to use less resources.
> Normally, when I've an object I use declarations like this:
>
> pro myobject__define
> struct = { myobject, $
> data: ptr_new() }
> end
>
> Now for example if my object has to save an array like FLTARR
> (400,400,24,97) I will use the data pointer to store this array. The
> problem is that if I do this I take a lot of computer resources. With
> this example:
> help, /mem
> aa=fltarr(400,400,24,97)
> myobject->SetProperty, DATA=aa
> aa=0l
> help, /mem
>
> IDl returns:
> heap memory used: 658906, max: 805215874, gets: 1195,
> frees: 387
> heap memory used: 1490578946, max: 1490579037, gets: 1207,
> frees: 398
>
> So, only for this example I'm using 1.4 Gb aprox. I tried to used
> ASSOC procedure but I didn't succeed.... Some suggestions or comments
> about how to reduce the memory ? There is a method to store compressed
> data or something similar ?
I think I would learn how to put data into a pointer without
making a copy of it:
http://www.dfanning.com/misc_tips/pointers.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|