On 03/23/2011 08:05 PM, Daniel Lepage wrote: > Hi all, > Is there a way to mark an array as uncopyable? If you have very > large data arrays some numpy functions will cause MemoryErrors because > behind the scenes they e.g. transpose the arrays into Fortran order to > feed them into Fortran libraries (numpy.linalg.svd is an example of > this). It would be great if there were a way to mark an array as "too > big to copy" so that an attempt to call transpose() or astype() would > raise an exception immediately instead of clobbering the machine's > memory first, but I don't know of any flag that does this. > > I suppose I could always subclass ndarray and redefine transpose(), > astype(), etc., but it'd be nice if there were an easier way.
This is a bit OT, but if your problem is simply wanting to fail hard when using too much memory instead of swapping to disk, then on Unix systems you can use "ulimit -v" to limit how much memory your application can use. When I do this the MemoryError is quick and painless. Dag Sverre _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
