<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>David Vlijmincx on foojay.io - Friends of OpenJDK</title><link>https://foojayio.github.io/website/today/author/david-vlijmincx/</link><description>Articles written by David Vlijmincx on foojay.io - Friends of OpenJDK</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 07 Apr 2026 10:00:43 +0000</lastBuildDate><atom:link href="https://foojayio.github.io/website/today/author/david-vlijmincx/index.xml" rel="self" type="application/rss+xml"/><item><title>Thread Safe Native Memory in Java</title><link>https://foojayio.github.io/website/today/java-native-memory-access-modes/</link><pubDate>Tue, 07 Apr 2026 10:00:43 +0000</pubDate><guid>https://foojayio.github.io/website/today/java-native-memory-access-modes/</guid><description>&lt;h2 id="h2-0-what-is-memory-order-and-why-does-it-matter-for-native-memory"&gt;What is Memory Order and Why Does It Matter for Native Memory?&lt;/h2&gt;
&lt;p&gt;The Foreign Function and Memory (FFM) API is Java&amp;rsquo;s way of interacting with native code and memory. In the previous post, you learned how to do so using Java&amp;rsquo;s built-in &lt;code&gt;Arena&lt;/code&gt; types. The Arena provides temporal safety and bounds checks, but what about thread safety? MemorySegments created by &lt;code&gt;.ofShared()&lt;/code&gt;, &lt;code&gt;.auto()&lt;/code&gt;, and &lt;code&gt;.global()&lt;/code&gt; can be used by multiple threads at the same time. Using a VarHandle with just get/set can backfire if you don&amp;rsquo;t use something like locking. The downside is that locks are slow and heavy. So let us take a look at a more granular, hardware-aware approach: using VarHandle access modes.&lt;/p&gt;</description></item><item><title>Native Memory in Java: Arenas, Malloc, and Pools</title><link>https://foojayio.github.io/website/today/java-native-memory-allocation-ffm-api/</link><pubDate>Fri, 20 Mar 2026 10:20:04 +0000</pubDate><guid>https://foojayio.github.io/website/today/java-native-memory-allocation-ffm-api/</guid><description>&lt;h2 id="h2-0-what-is-the-memory-api"&gt;What is the Memory API&lt;/h2&gt;
&lt;p&gt;The Foreign Function &amp;amp; Memory (FFM) API is Java&amp;rsquo;s new way of interacting with native code and memory. It is mostly useful when storing data off-heap or passing arguments to a native method. Handling this native memory comes down to balancing how much control you need against the risk of memory leaks. You can rely on the provided &lt;code&gt;Arena&lt;/code&gt;s to bind memory to safe scopes, or you do it yourself using &lt;code&gt;malloc&lt;/code&gt; and &lt;code&gt;free&lt;/code&gt; for absolute control, or implement custom pools and slices to optimize allocations for your use case.&lt;/p&gt;</description></item><item><title>Pointer Arithmetic in Modern Java</title><link>https://foojayio.github.io/website/today/pointer-arithmetic-in-modern-java/</link><pubDate>Thu, 15 Jan 2026 09:00:12 +0000</pubDate><guid>https://foojayio.github.io/website/today/pointer-arithmetic-in-modern-java/</guid><description>&lt;h2 id="_introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;In this post, we dive into a more advanced topic: pointer arithmetic in Java. With the introduction of the Foreign Function &amp;amp; Memory API (Panama), we can interact with native memory.&lt;/p&gt;
&lt;p&gt;Usually, when we work with off-heap memory, we use &lt;code&gt;MemorySegment&lt;/code&gt; instances to ensure safety. However, creating these objects can sometimes add overhead. In this post, we will look at how to access native memory using addresses. The goal is to create fewer objects that are not strictly needed and only add GC pressure.&lt;/p&gt;</description></item><item><title>Benchmark and profiling Java with JMH</title><link>https://foojayio.github.io/website/today/benchmarking-and-profiling-java-with-jmh/</link><pubDate>Tue, 24 Jun 2025 21:49:25 +0000</pubDate><guid>https://foojayio.github.io/website/today/benchmarking-and-profiling-java-with-jmh/</guid><description>&lt;h2 id="h2-0-introduction-why-jmh"&gt;Introduction: Why JMH?&lt;/h2&gt;
&lt;p&gt;Performance matters in Java applications, but measuring it accurately is harder than you might think. I&amp;rsquo;ve seen countless developers try to measure performance by wrapping code in System.currentTimeMillis() calls or using simple timing loops, only to get misleading results due to JVM optimizations, garbage collection, or just mistakes during measurement.&lt;/p&gt;
&lt;p&gt;The JVM is incredibly good at optimizing code, sometimes so good that it optimizes away the very code you&amp;rsquo;re trying to benchmark. Dead code elimination, constant folding, and just-in-time compilation can all skew your measurements in ways that don&amp;rsquo;t reflect real-world performance.&lt;/p&gt;</description></item><item><title>Async file IO with Java and io_uring</title><link>https://foojayio.github.io/website/today/async-file-io-with-java-and-io_uring/</link><pubDate>Fri, 18 Apr 2025 09:28:16 +0000</pubDate><guid>https://foojayio.github.io/website/today/async-file-io-with-java-and-io_uring/</guid><description>&lt;p&gt;When I first started exploring Virtual Threads in Java, I wanted to understand everything about them like, performance characteristics, when they yield, and limitations. This journey led me to an interesting challenge about file I/O operations. These operations cause Virtual Threads to become &amp;ldquo;pinned&amp;rdquo; to platform threads, limiting their effectiveness for I/O-heavy applications.&lt;/p&gt;
&lt;p&gt;This pinning issue has been widely acknowledged across the Java community. It&amp;rsquo;s mentioned in the Virtual Threads &lt;a href="https://openjdk.org/jeps/425" target="_blank" rel="noopener noreferrer"&gt;JEP&lt;/a&gt;
, discussed on &lt;a href="https://www.reddit.com/r/java/comments/1h0cr5g/comment/lz3lv11/" target="_blank" rel="noopener noreferrer"&gt;Reddit threads&lt;/a&gt;
, debated on &lt;a href="https://mail.openjdk.org/pipermail/loom-dev/2024-June/006638.html" target="_blank" rel="noopener noreferrer"&gt;mailing lists&lt;/a&gt;
, and highlighted in the &amp;ldquo;&lt;a href="https://cr.openjdk.org/~rpressler/loom/loom/sol1_part1.html" target="_blank" rel="noopener noreferrer"&gt;State of Loom&lt;/a&gt;
&amp;rdquo;. The consistent message: File I/O and Virtual Threads don&amp;rsquo;t play nicely together.&lt;/p&gt;</description></item></channel></rss>