src/share/vm/runtime/os.cpp

Print this page
rev 2100 : 7017193 Small memory leak in get_stack_bounds // os::create_stack_guard_pages


1275   //     based on the sizes of DIMMs, and maybe graphics cards.
1276   const julong missing_memory   = 256UL * M;
1277 
1278   /* Is this a server class machine? */
1279   if ((os::active_processor_count() >= (int)server_processors) &&
1280       (os::physical_memory() >= (server_memory - missing_memory))) {
1281     const unsigned int logical_processors =
1282       VM_Version::logical_processors_per_package();
1283     if (logical_processors > 1) {
1284       const unsigned int physical_packages =
1285         os::active_processor_count() / logical_processors;
1286       if (physical_packages > server_processors) {
1287         result = true;
1288       }
1289     } else {
1290       result = true;
1291     }
1292   }
1293   return result;
1294 }

































1275   //     based on the sizes of DIMMs, and maybe graphics cards.
1276   const julong missing_memory   = 256UL * M;
1277 
1278   /* Is this a server class machine? */
1279   if ((os::active_processor_count() >= (int)server_processors) &&
1280       (os::physical_memory() >= (server_memory - missing_memory))) {
1281     const unsigned int logical_processors =
1282       VM_Version::logical_processors_per_package();
1283     if (logical_processors > 1) {
1284       const unsigned int physical_packages =
1285         os::active_processor_count() / logical_processors;
1286       if (physical_packages > server_processors) {
1287         result = true;
1288       }
1289     } else {
1290       result = true;
1291     }
1292   }
1293   return result;
1294 }
1295 
1296 //Read file line by line, if line is longer than bsize,
1297 //skip rest of line.
1298 int os::get_line_chars(int fd, char* buf, size_t bsize){
1299   unsigned int sz,i = 0;
1300 
1301   while( (sz=read(fd, &buf[i], 1)) == 1 && i < (bsize-1) && buf[i] != '\n' ) {
1302      ++i;
1303   }
1304 
1305   // whole line was read, kill eol char and return
1306   if (buf[i] == '\n'){
1307      buf[i] = 0; 
1308      return i-1;
1309   }
1310 
1311   buf[i+1] = 0; 
1312 
1313   // EOF reached. if we have characters in buf return 
1314   // partially read line and delay eof to next call
1315   if (sz != 1) {
1316     return (i == 0) ? -1 : i;
1317   }
1318 
1319   // line is longer than bsize, skip to EOL
1320   int ch;
1321   while( read(fd, &ch, 1) == 1 && ch != '\n' );
1322 
1323   // ignore eof, will catch it next time
1324   return i;
1325 }