diff --git a/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c b/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c index 991849697dd..3a506d68e05 100644 --- a/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c +++ b/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c @@ -211,6 +211,7 @@ void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) { // We have no exact command or the arguments are truncated. // In this case we save the command line from /proc//cmdline. args = (char*)malloc(pageSize + 1); + printf(" !j9x 0x%p,0x%zX %s\n", args, (size_t)pageSize + 1, "ProcesshandleImpl_linux.c:214"); if (args != NULL) { memcpy(args, cmdline, cmdlen + 1); for (i = 0; i < cmdlen; i++) { diff --git a/src/java.base/macosx/native/libnet/DefaultProxySelector.c b/src/java.base/macosx/native/libnet/DefaultProxySelector.c index aa91f3012b2..b5220e83e30 100644 --- a/src/java.base/macosx/native/libnet/DefaultProxySelector.c +++ b/src/java.base/macosx/native/libnet/DefaultProxySelector.c @@ -193,6 +193,8 @@ Java_sun_net_spi_DefaultProxySelector_getSystemProxies(JNIEnv *env, /* Construct the uri, cproto + "://" + chost */ uri = malloc(protoLen + hostLen + 4); + printf(" !j9x 0x%p,0x%zX %s\n", uri,(size_t) protoLen + hostLen + 4, "DEfaultProxySelector.c:196"); + if (uri != NULL) { memcpy(uri, cproto, protoLen); memcpy(uri + protoLen, "://", 3); diff --git a/src/java.base/share/native/libjava/Class.c b/src/java.base/share/native/libjava/Class.c index 8e0870cadee..80ab7038682 100644 --- a/src/java.base/share/native/libjava/Class.c +++ b/src/java.base/share/native/libjava/Class.c @@ -119,6 +119,9 @@ Java_java_lang_Class_forName0(JNIEnv *env, jclass this, jstring classname, unicode_len = (*env)->GetStringLength(env, classname); if (len >= (jsize)sizeof(buf)) { clname = malloc(len + 1); + printf(" !j9x 0x%p,0x%zX %s\n", clname,(size_t) len + 1, "Class.c:122"); + + if (clname == NULL) { JNU_ThrowOutOfMemoryError(env, NULL); return NULL; diff --git a/src/java.base/share/native/libjava/NativeLibraries.c b/src/java.base/share/native/libjava/NativeLibraries.c index 8debad88e63..ca9bcaa7ddd 100644 --- a/src/java.base/share/native/libjava/NativeLibraries.c +++ b/src/java.base/share/native/libjava/NativeLibraries.c @@ -96,6 +96,8 @@ static void *findJniFunction(JNIEnv *env, void *handle, goto done; } jniFunctionName = malloc(len); + printf(" !j9x 0x%p,0x%zX %s\n", jniFunctionName,(size_t) len, "NativeLibraries.c:99"); + if (jniFunctionName == NULL) { JNU_ThrowOutOfMemoryError(env, NULL); goto done; @@ -293,6 +295,8 @@ Java_jdk_internal_loader_NativeLibraries_findBuiltinLib return NULL; } libName = malloc(len + 1); //+1 for null if prefix+suffix == 0 + printf(" !j9x 0x%p,0x%zX %s\n", libName, (size_t)len + 1, "NativeLibraries.c:298"); + if (libName == NULL) { JNU_ReleaseStringPlatformChars(env, name, cname); JNU_ThrowOutOfMemoryError(env, NULL); diff --git a/src/java.base/share/native/libjava/io_util.c b/src/java.base/share/native/libjava/io_util.c index 70b20157f6e..5a4467bc15f 100644 --- a/src/java.base/share/native/libjava/io_util.c +++ b/src/java.base/share/native/libjava/io_util.c @@ -93,6 +93,8 @@ readBytes(JNIEnv *env, jobject this, jbyteArray bytes, return 0; } else if (len > BUF_SIZE) { buf = malloc(len); + printf(" !j9x 0x%p,0x%zX %s\n", buf,(size_t) len + 1, "io_util.c:96"); + if (buf == NULL) { JNU_ThrowOutOfMemoryError(env, NULL); return 0; @@ -165,6 +167,8 @@ writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, return; } else if (len > BUF_SIZE) { buf = malloc(len); + printf(" !j9x 0x%p,0x%zX %s\n", buf, (size_t)len, "io_util.c:170"); + if (buf == NULL) { JNU_ThrowOutOfMemoryError(env, NULL); return; diff --git a/src/java.base/share/native/libjava/jni_util.c b/src/java.base/share/native/libjava/jni_util.c index 7699bdf4637..70c2f0bcba3 100644 --- a/src/java.base/share/native/libjava/jni_util.c +++ b/src/java.base/share/native/libjava/jni_util.c @@ -40,9 +40,17 @@ * negative, or the size is INT_MAX as the macro adds 1 * that overflows into negative value. */ + +void* mallocWrap(size_t size) { + void * mem = malloc(size); + printf(" !j9x 0x%p,0x%zX %s\n", mem, (size_t)size, "jni_util.c:46"); + + return mem; +} + #define MALLOC_MIN4(len) ((unsigned)(len) >= INT_MAX ? \ NULL : \ - ((char *)malloc((len) + 1 < 4 ? 4 : (len) + 1))) + ((char *)mallocWrap((len) + 1 < 4 ? 4 : (len) + 1))) /** * Throw a Java exception by name. Similar to SignalError. diff --git a/src/java.base/share/native/libjli/jli_util.c b/src/java.base/share/native/libjli/jli_util.c index 3b24a784491..37e8109a83f 100644 --- a/src/java.base/share/native/libjli/jli_util.c +++ b/src/java.base/share/native/libjli/jli_util.c @@ -37,6 +37,9 @@ JNIEXPORT void * JNICALL JLI_MemAlloc(size_t size) { void *p = malloc(size); + printf(" !j9x 0x%p,0x%zX %s\n", p,(size_t) size, "jli_util.c:40"); + + if (p == 0) { perror("malloc"); exit(1); diff --git a/src/java.base/unix/native/launcher/jexec.c b/src/java.base/unix/native/launcher/jexec.c index bd6458c67a1..050b70faada 100644 --- a/src/java.base/unix/native/launcher/jexec.c +++ b/src/java.base/unix/native/launcher/jexec.c @@ -176,6 +176,8 @@ int main(int argc, const char * argv[]) { errorExit(errno, BAD_ARG_MSG); } nargv = (const char **) malloc(alen); + printf(" !j9x 0x%p,0x%zX %s\n", nargv, (size_t)alen, "jexec.c:179"); + if (nargv == NULL) { errorExit(errno, MEM_FAILED_MSG); } diff --git a/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c b/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c index d53e88764c5..013276e91d0 100644 --- a/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c +++ b/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c @@ -465,6 +465,8 @@ void unix_getUserInfo(JNIEnv* env, jobject jinfo, uid_t uid) { /* allocate buffer for password record */ pwbuf = (char*)malloc(getpw_buf_size); + printf(" !j9x 0x%p,0x%zX %s\n", pwbuf, (size_t)getpw_buf_size, "ProcessHandleImpl_unix.c:468"); + if (pwbuf == NULL) { JNU_ThrowOutOfMemoryError(env, "Unable to open getpwent"); } else { diff --git a/src/java.base/unix/native/libjava/ProcessImpl_md.c b/src/java.base/unix/native/libjava/ProcessImpl_md.c index 640f449d3f0..b7b55a4694a 100644 --- a/src/java.base/unix/native/libjava/ProcessImpl_md.c +++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c @@ -215,6 +215,8 @@ static void* xmalloc(JNIEnv *env, size_t size) { void *p = malloc(size); + printf(" !j9x 0x%p,0x%zX %s\n", p,(size_t) size, "ProcessHandleImpl_md.c:218"); + if (p == NULL) JNU_ThrowOutOfMemoryError(env, NULL); return p; diff --git a/src/java.base/unix/native/libjava/TimeZone_md.c b/src/java.base/unix/native/libjava/TimeZone_md.c index 5c40fc8b320..5988d4d0368 100644 --- a/src/java.base/unix/native/libjava/TimeZone_md.c +++ b/src/java.base/unix/native/libjava/TimeZone_md.c @@ -103,6 +103,8 @@ getPathName(const char *dir, const char *name) { char *path; path = (char *) malloc(strlen(dir) + strlen(name) + 2); + printf(" !j9x 0x%p,0x%zX %s\n", path,(size_t) strlen(dir) + strlen(name) + 2, "Timezon_md.c:106"); + if (path == NULL) { return NULL; } @@ -206,6 +208,8 @@ isFileIdentical(char *buf, size_t size, char *pathname) possibleMatch = findZoneinfoFile(buf, size, pathname); } else if (S_ISREG(statbuf.st_mode) && (size_t)statbuf.st_size == size) { dbuf = (char *) malloc(size); + printf(" !j9x 0x%p,0x%zX %s\n", dbuf,(size_t) size, "Timezon_md.c:211"); + if (dbuf == NULL) { return NULL; } @@ -321,6 +325,8 @@ getPlatformTimeZoneID() } size = (size_t) statbuf.st_size; buf = (char *) malloc(size); + printf(" !j9x 0x%p,0x%zX %s\n", buf,(size_t) size, "Timezon_md.c:328"); + if (buf == NULL) { (void) close(fd); return NULL; diff --git a/src/java.base/unix/native/libjava/io_util_md.c b/src/java.base/unix/native/libjava/io_util_md.c index e207c57d49b..4889d60214c 100644 --- a/src/java.base/unix/native/libjava/io_util_md.c +++ b/src/java.base/unix/native/libjava/io_util_md.c @@ -56,6 +56,8 @@ jstring newStringPlatform(JNIEnv *env, const char* str) int clen = CFStringGetLength(csref); int ulen = (clen + 1) * 2; // utf16 + zero padding char* chars = malloc(ulen); + printf(" !j9x 0x%p,0x%zX %s\n", chars,(size_t) ulen, "io_util_md.c:59"); + if (chars == NULL) { CFRelease(csref); JNU_ThrowOutOfMemoryError(env, "native heap"); diff --git a/src/java.base/unix/native/libjava/java_props_md.c b/src/java.base/unix/native/libjava/java_props_md.c index 36a08d4c156..c3714e5934d 100644 --- a/src/java.base/unix/native/libjava/java_props_md.c +++ b/src/java.base/unix/native/libjava/java_props_md.c @@ -112,6 +112,8 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s } temp = malloc(strlen(lc) + 1); + printf(" !j9x 0x%p,0x%zX %s\n", temp, (size_t)strlen(lc) + 1, "java_props_md.c:115"); + if (temp == NULL) { #ifdef MACOSX free(lc); // malloced memory @@ -143,6 +145,7 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s } temp = malloc(strlen(lc) + 1); + printf(" !j9x 0x%p,0x%zX %s\n", temp, (size_t)strlen(lc) + 1, "java_props_md.c:148"); if (temp == NULL) { JNU_ThrowOutOfMemoryError(env, NULL); return 0; @@ -175,6 +178,8 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s */ encoding_variant = malloc(strlen(temp)+1); + printf(" !j9x 0x%p,0x%zX %s\n", encoding_variant, (size_t)strlen(temp)+1, "java_props_md.c:181"); + if (encoding_variant == NULL) { free(temp); JNU_ThrowOutOfMemoryError(env, NULL); @@ -238,6 +243,8 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s *std_language = "en"; if (language != NULL && mapLookup(language_names, language, std_language) == 0) { *std_language = malloc(strlen(language)+1); + printf(" !j9x 0x%p,0x%zX %s\n", *std_language, (size_t)strlen(language)+1, "java_props_md.c:246"); + strcpy(*std_language, language); } } @@ -246,6 +253,8 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s if (std_country != NULL && country != NULL) { if (mapLookup(country_names, country, std_country) == 0) { *std_country = malloc(strlen(country)+1); + printf(" !j9x 0x%p,0x%zX %s\n", *std_country,(size_t) strlen(country)+1, "java_props_md.c:256"); + strcpy(*std_country, country); } } @@ -405,6 +414,9 @@ GetJavaProperties(JNIEnv *env) { char *os_version = malloc(strlen(name.version) + strlen(name.release) + 2); + + printf(" !j9x 0x%p,0x%zX %s\n", os_version,(size_t) strlen(name.version) + strlen(name.release) + 2, "java_props_md.c:418"); + if (os_version != NULL) { strcpy(os_version, name.version); strcat(os_version, "."); diff --git a/src/java.base/unix/native/libnet/DefaultProxySelector.c b/src/java.base/unix/native/libnet/DefaultProxySelector.c index 2ef9637af9a..6af8ca231bd 100644 --- a/src/java.base/unix/native/libnet/DefaultProxySelector.c +++ b/src/java.base/unix/native/libnet/DefaultProxySelector.c @@ -356,6 +356,8 @@ static jobjectArray getProxyByGProxyResolver(JNIEnv *env, const char *cproto, protoLen = strlen(cproto); hostLen = strlen(chost); uri = malloc(protoLen + hostLen + 4); + printf(" !j9x 0x%p,0x%zX %s\n", uri,(size_t) protoLen + hostLen + 4, "DEfaultProxySelector.c:349"); + if (!uri) { /* Out of memory */ return NULL; diff --git a/src/java.base/unix/native/libnet/Inet4AddressImpl.c b/src/java.base/unix/native/libnet/Inet4AddressImpl.c index 5b8f38b4523..81b1e8c417d 100644 --- a/src/java.base/unix/native/libnet/Inet4AddressImpl.c +++ b/src/java.base/unix/native/libnet/Inet4AddressImpl.c @@ -140,6 +140,8 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, if (!skip) { struct addrinfo *next = (struct addrinfo *)malloc(sizeof(struct addrinfo)); + printf(" !j9x 0x%p,0x%zX %s\n", next,(size_t) sizeof(struct addrinfo), "Inet4address.c:143"); + if (!next) { JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed"); ret = NULL; diff --git a/src/java.base/unix/native/libnet/Inet6AddressImpl.c b/src/java.base/unix/native/libnet/Inet6AddressImpl.c index e9e7adb192b..dd252d2851f 100644 --- a/src/java.base/unix/native/libnet/Inet6AddressImpl.c +++ b/src/java.base/unix/native/libnet/Inet6AddressImpl.c @@ -292,6 +292,8 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, if (!skip) { struct addrinfo *next = (struct addrinfo *)malloc(sizeof(struct addrinfo)); + printf(" !j9x 0x%p,0x%zX %s\n", next,(size_t) sizeof(struct addrinfo), "Inet6address.c:143"); + if (!next) { JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed"); ret = NULL; diff --git a/src/java.base/unix/native/libnet/NetworkInterface.c b/src/java.base/unix/native/libnet/NetworkInterface.c index dcaf3fd51d1..b46bf5b4a03 100644 --- a/src/java.base/unix/native/libnet/NetworkInterface.c +++ b/src/java.base/unix/native/libnet/NetworkInterface.c @@ -60,6 +60,7 @@ #define CHECKED_MALLOC3(_pointer, _type, _size) \ do { \ _pointer = (_type)malloc(_size); \ + printf(" !j9x 0x%p,0x%zX %s\n", _pointer,(size_t) _size, "NetworkInterface.c:63"); \ if (_pointer == NULL) { \ JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed"); \ return ifs; /* return untouched list */ \ @@ -1601,6 +1602,7 @@ static int getMacAddress } nddp = (struct kinfo_ndd *)malloc(size); + printf(" !j9x 0x%p,0x%zX %s\n", nddp,(size_t) size, "NetworkInterface.c:1605"); if (!nddp) { JNU_ThrowOutOfMemoryError(env, diff --git a/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c b/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c index c0d5699bbd8..fa3d61b926b 100644 --- a/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c +++ b/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c @@ -401,6 +401,7 @@ Java_java_net_PlainDatagramSocketImpl_send0(JNIEnv *env, jobject this, packetBufferLen = MAX_PACKET_LEN; } fullPacket = (char *)malloc(packetBufferLen); + printf(" !j9x 0x%p,0x%zX %s\n", fullPacket,(size_t) packetBufferLen, "PlainDatagramSocket.c:404"); if (!fullPacket) { JNU_ThrowOutOfMemoryError(env, "Send buffer native heap allocation failed"); @@ -750,6 +751,8 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this, packetBufferLen = MAX_PACKET_LEN; } fullPacket = (char *)malloc(packetBufferLen); + printf(" !j9x 0x%p,0x%zX %s\n", fullPacket,(size_t) packetBufferLen, "PlainDatagramSocket.c:755"); + if (!fullPacket) { JNU_ThrowOutOfMemoryError(env, "Receive buffer native heap allocation failed"); diff --git a/src/java.base/unix/native/libnet/SocketInputStream.c b/src/java.base/unix/native/libnet/SocketInputStream.c index 7d927bd02a1..479c2b4c0ec 100644 --- a/src/java.base/unix/native/libnet/SocketInputStream.c +++ b/src/java.base/unix/native/libnet/SocketInputStream.c @@ -116,6 +116,8 @@ Java_java_net_SocketInputStream_socketRead0(JNIEnv *env, jobject this, len = MAX_HEAP_BUFFER_LEN; } bufP = (char *)malloc((size_t)len); + printf(" !j9x 0x%p,0x%zX %s\n", bufP,(size_t) len, "SocketInputStream.c:119"); + if (bufP == NULL) { bufP = BUF; len = MAX_BUFFER_LEN; diff --git a/src/java.base/unix/native/libnet/SocketOutputStream.c b/src/java.base/unix/native/libnet/SocketOutputStream.c index 0962235bc35..6b3e71f768f 100644 --- a/src/java.base/unix/native/libnet/SocketOutputStream.c +++ b/src/java.base/unix/native/libnet/SocketOutputStream.c @@ -84,6 +84,8 @@ Java_java_net_SocketOutputStream_socketWrite0(JNIEnv *env, jobject this, } else { buflen = min(MAX_HEAP_BUFFER_LEN, len); bufP = (char *)malloc((size_t)buflen); + printf(" !j9x 0x%p,0x%zX %s\n", bufP,(size_t) buflen, "SocketOuputStream.c:87"); + /* if heap exhausted resort to stack buffer */ if (bufP == NULL) { diff --git a/src/java.base/unix/native/libnet/net_util_md.c b/src/java.base/unix/native/libnet/net_util_md.c index 139cb27b4fb..eb95d161fa1 100644 --- a/src/java.base/unix/native/libnet/net_util_md.c +++ b/src/java.base/unix/native/libnet/net_util_md.c @@ -219,6 +219,8 @@ void NET_ThrowUnknownHostExceptionWithGaiError(JNIEnv *env, size = strlen(format) + strlen(hostname) + strlen(error_string) + 2; buf = (char *) malloc(size); + printf(" !j9x 0x%p,0x%zX %s\n", buf,(size_t) size, "net_util_md.c:222"); + if (buf) { jstring s; snprintf(buf, size, format, hostname, error_string); diff --git a/src/java.base/unix/native/libnio/MappedMemoryUtils.c b/src/java.base/unix/native/libnio/MappedMemoryUtils.c index 4c9b72e51ad..2abf038cb17 100644 --- a/src/java.base/unix/native/libnio/MappedMemoryUtils.c +++ b/src/java.base/unix/native/libnio/MappedMemoryUtils.c @@ -76,6 +76,8 @@ Java_java_nio_MappedMemoryUtils_isLoaded0(JNIEnv *env, jobject obj, jlong addres /* Include space for one sentinel byte at the end of the buffer * to catch overflows. */ vec = (mincore_vec_t*) malloc(numPages + 1); + printf(" !j9x 0x%p,0x%zX %s\n", vec,(size_t) numPages + 1, "MappedMemoryUtils.c:79"); + if (vec == NULL) { JNU_ThrowOutOfMemoryError(env, NULL); diff --git a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c index ea9eac66963..cf8bdcfe649 100644 --- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c +++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c @@ -1329,6 +1329,8 @@ Java_sun_nio_fs_UnixNativeDispatcher_getpwuid(JNIEnv* env, jclass this, jint uid if (buflen == -1) buflen = ENT_BUF_SIZE; pwbuf = (char*)malloc(buflen); + printf(" !j9x 0x%p,0x%zX %s\n", pwbuf,(size_t) buflen, "UnixNativeDispather.c:1332"); + if (pwbuf == NULL) { JNU_ThrowOutOfMemoryError(env, "native heap"); } else { @@ -1376,6 +1378,8 @@ Java_sun_nio_fs_UnixNativeDispatcher_getgrgid(JNIEnv* env, jclass this, jint gid int res = 0; char* grbuf = (char*)malloc(buflen); + printf(" !j9x 0x%p,0x%zX %s\n", grbuf,(size_t) buflen, "UnixNativeDispather.c:1381"); + if (grbuf == NULL) { JNU_ThrowOutOfMemoryError(env, "native heap"); return NULL; @@ -1424,6 +1428,8 @@ Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0(JNIEnv* env, jclass this, if (buflen == -1) buflen = ENT_BUF_SIZE; pwbuf = (char*)malloc(buflen); + printf(" !j9x 0x%p,0x%zX %s\n", pwbuf,(size_t) buflen, "UnixNativeDispather.c:1431"); + if (pwbuf == NULL) { JNU_ThrowOutOfMemoryError(env, "native heap"); } else { @@ -1471,6 +1477,8 @@ Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0(JNIEnv* env, jclass this, const char* name = (const char*)jlong_to_ptr(nameAddress); grbuf = (char*)malloc(buflen); + printf(" !j9x 0x%p,0x%zX %s\n", grbuf,(size_t) buflen, "UnixNativeDispather.c:1480"); + if (grbuf == NULL) { JNU_ThrowOutOfMemoryError(env, "native heap"); return -1; diff --git a/src/java.instrument/share/native/libinstrument/InvocationAdapter.c b/src/java.instrument/share/native/libinstrument/InvocationAdapter.c index 3b05b7c86f8..f71f4b9c68f 100644 --- a/src/java.instrument/share/native/libinstrument/InvocationAdapter.c +++ b/src/java.instrument/share/native/libinstrument/InvocationAdapter.c @@ -73,6 +73,7 @@ parseArgumentTail(char* tail, char** name, char** options) { len = (pos == NULL) ? (int)strlen(tail) : (int)(pos - tail); *name = (char*)malloc(len+1); + printf(" !j9x 0x%p,0x%zX %s\n", name,(size_t) len+1, "InvocationAdapater.c:76"); if (*name == NULL) { return -1; } @@ -83,6 +84,7 @@ parseArgumentTail(char* tail, char** name, char** options) { *options = NULL; } else { char * str = (char*)malloc( (int)strlen(pos + 1) + 1 ); + printf(" !j9x 0x%p,0x%zX %s\n", str,(size_t) (int)strlen(pos + 1) + 1, "InvocationAdapater.c:87"); if (str == NULL) { free(*name); return -1; @@ -219,6 +221,7 @@ DEF_Agent_OnLoad(JavaVM *vm, char *tail, void * reserved) { premainClass = strdup(premainClass); } else { char* str = (char*)malloc( newLen+1 ); + printf(" !j9x 0x%p,0x%zX %s\n", str,(size_t) newLen+1, "InvocationAdapater.c:224"); if (str != NULL) { convertUtf8ToModifiedUtf8(premainClass, oldLen, str, newLen); } @@ -390,6 +393,7 @@ DEF_Agent_OnAttach(JavaVM* vm, char *args, void * reserved) { agentClass = strdup(agentClass); } else { char* str = (char*)malloc( newLen+1 ); + printf(" !j9x 0x%p,0x%zX %s\n", str,(size_t) newLen+1, "InvocationAdapater.c:396"); if (str != NULL) { convertUtf8ToModifiedUtf8(agentClass, oldLen, str, newLen); } @@ -525,6 +529,7 @@ jint loadAgent(JNIEnv* env, jstring path) { agentClass = strdup(agentClass); } else { char* str = (char*) malloc(newLen + 1); + printf(" !j9x 0x%p,0x%zX %s\n", str,(size_t) newLen+1, "InvocationAdapater.c:532"); if (str != NULL) { convertUtf8ToModifiedUtf8(agentClass, oldLen, str, newLen); } diff --git a/src/java.instrument/share/native/libinstrument/JPLISAgent.c b/src/java.instrument/share/native/libinstrument/JPLISAgent.c index e939e4eff56..14cf602904a 100644 --- a/src/java.instrument/share/native/libinstrument/JPLISAgent.c +++ b/src/java.instrument/share/native/libinstrument/JPLISAgent.c @@ -775,6 +775,8 @@ getModuleObject(jvmtiEnv* jvmti, char* last_slash = (cname == NULL) ? NULL : strrchr(cname, '/'); int len = (last_slash == NULL) ? 0 : (int)(last_slash - cname); char* pkg_name_buf = (char*)malloc(len + 1); + printf(" !j9x 0x%p,0x%zX %s\n", pkg_name_buf,(size_t) len + 1, "JPLISAgent.c:778"); + if (pkg_name_buf == NULL) { fprintf(stderr, "OOM error in native tmp buffer allocation"); diff --git a/src/java.instrument/share/native/libinstrument/JarFacade.c b/src/java.instrument/share/native/libinstrument/JarFacade.c index 37afe59257f..66d3e566a7a 100644 --- a/src/java.instrument/share/native/libinstrument/JarFacade.c +++ b/src/java.instrument/share/native/libinstrument/JarFacade.c @@ -40,6 +40,7 @@ doAttribute(const char* name, const char* value, void* user_data) { iterationContext* context = (iterationContext*) user_data; jarAttribute* attribute = (jarAttribute*)malloc(sizeof(jarAttribute)); + printf(" !j9x 0x%p,0x%zX %s\n", attribute,(size_t) sizeof(jarAttribute), "JarFacade.c:43"); if (attribute != NULL) { attribute->name = strdup(name); if (attribute->name == NULL) { @@ -69,6 +70,9 @@ doAttribute(const char* name, const char* value, void* user_data) { value_len = (size_t)(end - begin); attribute->value = malloc(value_len + 1); + printf(" !j9x 0x%p,0x%zX %s\n", attribute->value,(size_t) value_len + 1, "JarFacade.c:73"); + + if (attribute->value == NULL) { free(attribute->name); free(attribute); diff --git a/src/java.instrument/unix/native/libinstrument/FileSystemSupport_md.c b/src/java.instrument/unix/native/libinstrument/FileSystemSupport_md.c index a58c1579f0c..28ec3435499 100644 --- a/src/java.instrument/unix/native/libinstrument/FileSystemSupport_md.c +++ b/src/java.instrument/unix/native/libinstrument/FileSystemSupport_md.c @@ -42,6 +42,8 @@ char* basePath(const char* path) { } else { int len = last - path; char* str = (char*)malloc(len+1); + printf(" !j9x 0x%p,0x%zX %s\n", str,(size_t) len + 1, "FileSystemSupport_md.c:45"); + if (str == NULL) { fprintf(stderr, "OOM error in native tmp buffer allocation"); return NULL; @@ -76,6 +78,8 @@ static char* normalizePath(const char* pathname, int len, int off) { if (n == 0) return strdup("/"); sb = (char*)malloc(strlen(pathname)+1); + printf(" !j9x 0x%p,0x%zX %s\n", sb,(size_t) strlen(pathname)+1, "FileSystemSupport_md.c:81"); + if (sb == NULL) { fprintf(stderr, "OOM error in native tmp buffer allocation"); return NULL; @@ -128,6 +132,7 @@ char* resolve(const char* parent, const char* child) { len = parentEnd + cn - childStart; if (child[0] == slash) { theChars = (char*)malloc(len+1); + printf(" !j9x 0x%p,0x%zX %s\n", theChars,(size_t) len+1, "FileSystemSupport_md.c:135"); if (theChars == NULL) { fprintf(stderr, "OOM error in native tmp buffer allocation"); return NULL; @@ -139,6 +144,8 @@ char* resolve(const char* parent, const char* child) { theChars[len] = '\0'; } else { theChars = (char*)malloc(len+2); + printf(" !j9x 0x%p,0x%zX %s\n", theChars,(size_t) len+2, "FileSystemSupport_md.c:147"); + if (theChars == NULL) { fprintf(stderr, "OOM error in native tmp buffer allocation"); return NULL; @@ -158,6 +165,8 @@ char* fromURIPath(const char* path) { if (len > 1 && path[len-1] == slash) { // "/foo/" --> "/foo", but "/" --> "/" char* str = (char*)malloc(len); + printf(" !j9x 0x%p,0x%zX %s\n", str,(size_t) len, "FileSystemSupport_md.c:168"); + if (str == NULL) { fprintf(stderr, "OOM error in native tmp buffer allocation"); diff --git a/src/java.instrument/windows/native/libinstrument/EncodingSupport_md.c b/src/java.instrument/windows/native/libinstrument/EncodingSupport_md.c index 5830d13a335..3f33dfb9546 100644 --- a/src/java.instrument/windows/native/libinstrument/EncodingSupport_md.c +++ b/src/java.instrument/windows/native/libinstrument/EncodingSupport_md.c @@ -59,6 +59,8 @@ convertUft8ToPlatformString(char* utf8_str, int utf8_len, char* platform_str, in wlen = MultiByteToWideChar(CP_UTF8, 0, utf8_str, utf8_len, NULL, 0); if (wlen > 0) { wstr = (WCHAR*)malloc(wlen * sizeof(WCHAR)); + printf(" !j9x 0x%p,0x%zX %s\n", wstr, wlen * sizeof(WCHAR), "EncodingSupport_md.c:62"); + if (wstr != NULL) { if (MultiByteToWideChar(CP_UTF8, 0, diff --git a/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.c b/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.c index 7fb8d9f53e9..78c6edaacf7 100644 --- a/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.c +++ b/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.c @@ -235,6 +235,8 @@ int main(int argc, char *argv[]) { } jvmLauncherData = malloc(jvmLauncherDataBufferSize); + printf(" !j9x 0x%p,0x%zX %s\n", jvmLauncherData, jvmLauncherDataBufferSize, "LinuxLauncher.c:238"); + if (!jvmLauncherData) { JP_LOG_ERRNO; goto cleanup; diff --git a/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c b/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c index 26d65f8061c..642665595fd 100644 --- a/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c +++ b/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c @@ -78,6 +78,8 @@ static PackageDesc* createPackageDesc(void) { PackageDesc* result = 0; result = malloc(sizeof(PackageDesc)); + printf(" !j9x 0x%p,0x%zX %s\n", result, sizeof(PackageDesc), "LinuxPackage.c:81"); + if (!result) { JP_LOG_ERRNO; goto cleanup; @@ -127,6 +129,8 @@ static int popenCommand(const char* cmdlineFormat, const char* arg, ptrdiff_t char_offset; cmdline = malloc(cmdlineLenth + 1 /* \0 */); + printf(" !j9x 0x%p,0x%zX %s\n", cmdline, cmdlineLenth + 1, "LinuxPackage.c:132"); + if (!cmdline) { JP_LOG_ERRNO; goto cleanup; @@ -209,6 +213,8 @@ static char* concat(const char *x, const char *y) { const size_t lenY = strlen(y); char *result = malloc(lenX + lenY + 1 /* \0 */); + printf(" !j9x 0x%p,0x%zX %s\n", result, lenX + lenY + 1, "LinuxPackage.c:216"); + if (!result) { JP_LOG_ERRNO; } else { diff --git a/src/jdk.jpackage/share/native/applauncher/JvmLauncherLib.c b/src/jdk.jpackage/share/native/applauncher/JvmLauncherLib.c index 6d3c9f3dd54..39b6c8ec06e 100644 --- a/src/jdk.jpackage/share/native/applauncher/JvmLauncherLib.c +++ b/src/jdk.jpackage/share/native/applauncher/JvmLauncherLib.c @@ -62,6 +62,7 @@ JvmlLauncherData* jvmLauncherCreateJvmlLauncherData( } buf = malloc(jvmLauncherDataBufferSize); + printf(" !j9x 0x%p,0x%zX %s\n", buf, jvmLauncherDataBufferSize, "JVMLauncherLic.c:65"); if (!buf) { JP_LOG_ERRNO; goto cleanup;