comparison src/os/solaris/vm/os_solaris.cpp @ 10161:746b070f5022

8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap" Reviewed-by: coleenp, zgu, hseigel
author ccheung
date Tue, 30 Apr 2013 11:56:52 -0700
parents 8be1318fbe77
children 9ce110b1d14a
comparison
equal deleted inserted replaced
10160:ed5a590835a4 10161:746b070f5022
822 } 822 }
823 823
824 // allocate new buffer and initialize 824 // allocate new buffer and initialize
825 info = (Dl_serinfo*)malloc(_info.dls_size); 825 info = (Dl_serinfo*)malloc(_info.dls_size);
826 if (info == NULL) { 826 if (info == NULL) {
827 vm_exit_out_of_memory(_info.dls_size, 827 vm_exit_out_of_memory(_info.dls_size, OOM_MALLOC_ERROR,
828 "init_system_properties_values info"); 828 "init_system_properties_values info");
829 } 829 }
830 info->dls_size = _info.dls_size; 830 info->dls_size = _info.dls_size;
831 info->dls_cnt = _info.dls_cnt; 831 info->dls_cnt = _info.dls_cnt;
832 832
864 // nulls included by the sizeof operator. 864 // nulls included by the sizeof operator.
865 size_t bufsize = sizeof(COMMON_DIR) + sizeof("/lib/") + strlen(cpu_arch); 865 size_t bufsize = sizeof(COMMON_DIR) + sizeof("/lib/") + strlen(cpu_arch);
866 common_path = malloc(bufsize); 866 common_path = malloc(bufsize);
867 if (common_path == NULL) { 867 if (common_path == NULL) {
868 free(info); 868 free(info);
869 vm_exit_out_of_memory(bufsize, 869 vm_exit_out_of_memory(bufsize, OOM_MALLOC_ERROR,
870 "init_system_properties_values common_path"); 870 "init_system_properties_values common_path");
871 } 871 }
872 sprintf(common_path, COMMON_DIR "/lib/%s", cpu_arch); 872 sprintf(common_path, COMMON_DIR "/lib/%s", cpu_arch);
873 873
874 // struct size is more than sufficient for the path components obtained 874 // struct size is more than sufficient for the path components obtained
877 bufsize = info->dls_size + strlen(common_path); 877 bufsize = info->dls_size + strlen(common_path);
878 library_path = malloc(bufsize); 878 library_path = malloc(bufsize);
879 if (library_path == NULL) { 879 if (library_path == NULL) {
880 free(info); 880 free(info);
881 free(common_path); 881 free(common_path);
882 vm_exit_out_of_memory(bufsize, 882 vm_exit_out_of_memory(bufsize, OOM_MALLOC_ERROR,
883 "init_system_properties_values library_path"); 883 "init_system_properties_values library_path");
884 } 884 }
885 library_path[0] = '\0'; 885 library_path[0] = '\0';
886 886
887 // Construct the desired Java library path from the linker's library 887 // Construct the desired Java library path from the linker's library
1621 // small number - point is NO swap space available 1621 // small number - point is NO swap space available
1622 void os::thread_local_storage_at_put(int index, void* value) { 1622 void os::thread_local_storage_at_put(int index, void* value) {
1623 // %%% this is used only in threadLocalStorage.cpp 1623 // %%% this is used only in threadLocalStorage.cpp
1624 if (thr_setspecific((thread_key_t)index, value)) { 1624 if (thr_setspecific((thread_key_t)index, value)) {
1625 if (errno == ENOMEM) { 1625 if (errno == ENOMEM) {
1626 vm_exit_out_of_memory(SMALLINT, "thr_setspecific: out of swap space"); 1626 vm_exit_out_of_memory(SMALLINT, OOM_MALLOC_ERROR,
1627 "thr_setspecific: out of swap space");
1627 } else { 1628 } else {
1628 fatal(err_msg("os::thread_local_storage_at_put: thr_setspecific failed " 1629 fatal(err_msg("os::thread_local_storage_at_put: thr_setspecific failed "
1629 "(%s)", strerror(errno))); 1630 "(%s)", strerror(errno)));
1630 } 1631 }
1631 } else { 1632 } else {