<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>Hi Jason, </div>
<div><br>
</div>
<div>looks like it is problematic to use LD_PRELOAD i had various crashes. I understand it is too much to ask, any configuration to look out for? </div>
<div>I think most probably i will use JNI to load jemalloc (<span class="Apple-style-span" style="font-family: monospace; font-size: 12px; white-space: pre; ">LD_LIBRARY_PATH</span>), looks like that works fine so far.</div>
<div><br>
</div>
<div>
<div>grep -A2 Problematic *</div>
<div>hs_err_pid1309.log:# Problematic frame:</div>
<div>hs_err_pid1309.log-# C  [libjemalloc.so+0xb79a]</div>
<div>hs_err_pid1309.log-#</div>
<div>--</div>
<div>hs_err_pid1622.log:# Problematic frame:</div>
<div>hs_err_pid1622.log-# C  [libjemalloc.so+0x57f4]  free+0x54</div>
<div>hs_err_pid1622.log-#</div>
<div>--</div>
<div>hs_err_pid16902.log:# Problematic frame:</div>
<div>hs_err_pid16902.log-# C  [libjemalloc.so+0xb79a]</div>
<div>hs_err_pid16902.log-[error occurred during error reporting (printing problematic frame), id 0xb]</div>
<div>--</div>
<div>hs_err_pid16902.log:# Problematic frame:</div>
<div>hs_err_pid16902.log-# C  [libjemalloc.so+0xb79a]</div>
<div>hs_err_pid16902.log-[error occurred during error reporting (printing problematic frame), id 0xb]</div>
<div>--</div>
<div>hs_err_pid2813.log:# Problematic frame:</div>
<div>hs_err_pid2813.log-# C  [libjemalloc.so+0xb79a]</div>
<div>hs_err_pid2813.log-[error occurred during error reporting (printing problematic frame), id 0xb]</div>
<div>--</div>
<div>hs_err_pid2813.log:# Problematic frame:</div>
<div>hs_err_pid2813.log-# C  [libjemalloc.so+0xb79a]</div>
<div>hs_err_pid2813.log-[error occurred during error reporting (printing problematic frame), id 0xb]</div>
<div>--</div>
<div>hs_err_pid29892.log:# Problematic frame:</div>
<div>hs_err_pid29892.log-# C  [libjemalloc.so+0xb79a]</div>
<div>hs_err_pid29892.log-#</div>
<div>--</div>
<div>hs_err_pid30273.log:# Problematic frame:</div>
<div>hs_err_pid30273.log-# C  [libjemalloc.so+0xb79a]</div>
<div>hs_err_pid30273.log-#</div>
<div>--</div>
<div>hs_err_pid30645.log:# Problematic frame:</div>
<div>hs_err_pid30645.log-# C  [libjemalloc.so+0xb79a]</div>
<div>hs_err_pid30645.log-#</div>
<div>--</div>
<div>hs_err_pid4037.log:# Problematic frame:</div>
<div>hs_err_pid4037.log-# C  [libjemalloc.so+0xb79a]</div>
<div>hs_err_pid4037.log-[error occurred during error reporting (printing problematic frame), id 0xb]</div>
<div>--</div>
<div>hs_err_pid7733.log:# Problematic frame:</div>
<div>hs_err_pid7733.log-# C  [libc.so.6+0x618a2]</div>
<div>hs_err_pid7733.log-[error occurred during error reporting (printing problematic frame), id 0xb]</div>
<div>--</div>
<div>hs_err_pid7733.log:# Problematic frame:</div>
<div>hs_err_pid7733.log-# C  [libc.so.6+0x618a2]</div>
<div>hs_err_pid7733.log-[error occurred during error reporting (printing problematic frame), id 0xb]</div>
<div>[vijay_tcasstest@vijay_tcass-i-a91ee8cd crash]$ </div>
</div>
<div><br>
</div>
<div><br>
<div>
<div>On Mar 25, 2012, at 12:21 AM, <a href="mailto:VIJAY2WIN@gmail.com">VIJAY2WIN@gmail.com</a> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div>Thanks Jason, <br>
I had one crash in the with in JVM version 1.6 and it crashed with following... So far with JVM 1.7 the test looks good still waiting for a way to crash it (I did verify that it uses JEMalloc).<br>
<br>
# Problematic frame:<br>
# C  [libjemalloc.so+0xb79a]<br>
#<br>
# If you would like to submit a bug report, please include<br>
# instructions how to reproduce the bug and visit:<br>
#   <a href="http://icedtea.classpath.org/bugzilla">http://icedtea.classpath.org/bugzilla</a><br>
#<br>
<br>
---------------  T H R E A D  ---------------<br>
<br>
Current thread (0x00002aac4ede7000):  JavaThread "Selector-Thread-3" [_thread_new, id=1555, stack(0x0000000000000000,0x0000000000000000)]<br>
<br>
siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x00002ab252cd9368<br>
<br>
Registers:<br>
RAX=0x00000000c217906f, RBX=0x00002aac42110000, RCX=0x0000000000000002, RDX=0x0000000000000000<br>
RSP=0x0000000042aa3eb0, RBP=0x0000000000000020, RSI=0x00002aac42110040, RDI=0x0000000000000006<br>
R8 =0x00002aaaab0009c0, R9 =0x0000000000000003, R10=0x00002aac42110ff0, R11=0x00000000c217906f<br>
R12=0xffffffffffffffe8, R13=0x0000000042aa3f80, R14=0x0000000000000020, R15=0x0000000000000000<br>
RIP=0x00002aaaaaab879a, EFL=0x0000000000010283, CSGSFS=0x000000000000e033, ERR=0x0000000000000004<br>
 TRAPNO=0x000000000000000e<br>
<br>
Top of Stack: (sp=0x0000000042aa3eb0)<br>
0x0000000042aa3eb0:   0000000000000000 0000000000000020<br>
0x0000000042aa3ec0:   0000000042aa3fe0 0000000042aa3ff0<br>
0x0000000042aa3ed0:   0000000042aa3f80 0000000000000020<br>
0x0000000042aa3ee0:   0000000000000000 00002aaaaaab2740<br>
0x0000000042aa3ef0:   0000000042aa4940 0000003a0cc08373<br>
0x0000000042aa3f00:   0000000000000000 0000000000000000<br>
0x0000000042aa3f10:   0000000000000000 0000000000000000<br>
0x0000000042aa3f20:   0000000000000000 0000000000000000<br>
0x0000000042aa3f30:   00002aad67d6c728 0000000000000000<br>
0x0000000042aa3f40:   0000003a0cc0a0e7 0000000042aa3ff8<br>
0x0000000042aa3f50:   0000000042aa3fe0 0000000042aa3ff0<br>
0x0000000042aa3f60:   0000000042aa3f80 00002aac4ede7000<br>
0x0000000042aa3f70:   0000000000000000 00002aaaabdaa354<br>
0x0000000042aa3f80:   0000000000000000 0000000000000009<br>
0x0000000042aa3f90:   0000000000000000 0000000042aa5000<br>
0x0000000042aa3fa0:   0000000000021000 00002aaaac432600<br>
0x0000000042aa3fb0:   00002aaaabb68da0 0000000000000007<br>
0x0000000042aa3fc0:   0000000042aa3ff0 00002aac4ede7000<br>
0x0000000042aa3fd0:   00002aac4ee12400 00002aac4ee06400<br>
0x0000000042aa3fe0:   0000000042aa4000 00002aaaabdaa415<br>
0x0000000042aa3ff0:   0000000042aa4020 00002aaaabea046e<br>
0x0000000042aa4000:   0000000042aa4020 00002aaaabe967b1<br>
0x0000000042aa4010:   00002aac4ee12400 00002aac4ede7000<br>
0x0000000042aa4020:   0000000042aa4040 00002aaaabe9cb14<br>
0x0000000042aa4030:   00002aac4ede7000 0000000000000000<br>
0x0000000042aa4040:   0000000042aa4110 00002aaaabda8ed4<br>
0x0000000042aa4050:   0000000000000000 0000000000000000<br>
0x0000000042aa4060:   0000000000000000 0000000000000000<br>
0x0000000042aa4070:   0000000000000000 0000000000000000<br>
0x0000000042aa4080:   0000000000000000 0000000000000000<br>
0x0000000042aa4090:   0000000000000000 0000000000000000<br>
0x0000000042aa40a0:   0000000000000000 0000000000000000<br>
<br>
Instructions: (pc=0x00002aaaaaab879a)<br>
0x00002aaaaaab878a:   06 89 46 08 7d 02 89 06 44 8b 5e 08 4c 8b 56 10<br>
0x00002aaaaaab879a:   4f 8b 34 da 4d 85 f6 0f 84 71 02 00 00 45 84 ff<br>
<br>
Stack: [0x0000000000000000,0x0000000000000000],  sp=0x0000000042aa3eb0,  free space=1092239k<br>
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)<br>
C  [libjemalloc.so+0xb79a]<br>
<br>
[error occurred during error reporting (printing native stack), id 0xb]<br>
<br>
<br>
On Mar 24, 2012, at 9:00 PM, Jason Evans wrote:<br>
<br>
<blockquote type="cite">On Mar 24, 2012, at 11:46 AM, Jason Evans wrote:<br>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">On Mar 23, 2012, at 4:21 PM, Vijay wrote:<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">Is there any reason i should not be using LD_PRELOAD to force JVM use jemalloc instead of native gcc malloc?<br>
</blockquote>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">Background: This is for Apache-Cassandra we do off-heap cache where we explicitly call malloc and free and by using jemalloc we see a fair amount of space savings and was wondering if there is anything which we have to consider before
 using it.<br>
</blockquote>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">LD_PRELOAD'ing jemalloc should be okay as long as the JVM doesn't statically link a different malloc implementation.  I expect that if it isn't safe, you'll experience crashes quite early on, so give it a try and see what happens.<br>
</blockquote>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">I was just looking through some of my notes and noticed an issue that may be relevant here.  jemalloc has a configure option called lazy-lock that has apparently caused problems in some Java use cases.  Java was using dlopen() to load
 a library that was dynamically linked with jemalloc, so jemalloc came along too late to intercept pthread_create() calls and turn on locking.  I don't think your use case will hit the same issue, but beware of dlopen() anywhere in the mix.<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Jason<br>
</blockquote>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</body>
</html>