I am building a scientific application in matlab which handles several hundred large matrices (large as in 'very few of these will fit into ram'). Each matrix is contained within a dedicated object to handle its metadata (the property's name is .data). I use the getter method to load the data from file into ram as soon as it is needed. How do I decide when to unload? Most access to the object's data will be bundled, thus I don't want to unload every time I am done with getting data. Furthermore, I might need to use one or two more often than others. I do not think I can solve this within each object, so I thought I could implement a public function to clear the matrix from ram, called by an external object that decides when (and possibly, which) object is too much right now.Does this make sense or is it a recipe for disaster? Does this count as observer, or is there something else I could use? How to identify 'good' decision criteria?Thanks!
Freeing Memory: Observer Pattern?
design patterns;observer pattern