From 2537b8612e37c4e00502240f15d873d23f501960 Mon Sep 17 00:00:00 2001 From: jiri Date: Thu, 23 Feb 2012 15:27:05 +0000 Subject: [PATCH] *** empty log message *** --- la_traits.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/la_traits.h b/la_traits.h index 802b4d3..12dcaf5 100644 --- a/la_traits.h +++ b/la_traits.h @@ -276,9 +276,10 @@ static inline void get(int fd, C &x, bool dimensions=0, bool transp=0) {if(sizeo static void multiget(size_t n,int fd, C *x, bool dimensions=0) { size_t total=0; + size_t system_limit = (1L<<30)/sizeof(C); //do not expect too much from the system and read at most 1GB at once ssize_t r; do{ - r=read(fd,x+total,(n-total)*sizeof(C)); + r=read(fd,x+total,(n-total > system_limit ? system_limit : n-total)*sizeof(C)); if(r<0 || r==0 && n!=0 ) {std::cout<<"read returned "< system_limit ? system_limit : n-total)*sizeof(C)); if(r<0 || r==0 && n!=0 ) {std::cout<<"write returned "<