{"id":122286,"date":"2026-01-15T09:00:12","date_gmt":"2026-01-15T09:00:12","guid":{"rendered":"https:\/\/foojay.io\/?p=122286"},"modified":"2026-01-19T10:06:59","modified_gmt":"2026-01-19T10:06:59","slug":"pointer-arithmetic-in-modern-java","status":"publish","type":"post","link":"https:\/\/foojay.io\/today\/pointer-arithmetic-in-modern-java\/","title":{"rendered":"Pointer Arithmetic in Modern Java"},"content":{"rendered":"\n    <div class=\"article__table\">\n        <div class=\"article__table-header\">\n            <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path d=\"M8 6H21\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M8 12H21\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M8 18H21\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M3 6H3.01\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M3 12H3.01\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M3 18H3.01\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n            <\/svg>\n            Table of Contents\n            <svg class=\"chevron\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path d=\"M18 15L12 9L6 15\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/>\n            <\/svg>\n        <\/div>\n        <div class=\"article__table-body\"><span><a href=\"#h2-0--ntroduction\">Introduction<\/a><\/span><span><a href=\"#h2-1--ackground-nfo\">Background Info<\/a><\/span><ul><li><a href=\"#h3-2--arning\">Warning<\/a><\/li><\/ul><span><a href=\"#h2-3--he-etup\">The Setup<\/a><\/span><span><a href=\"#h2-4--omparing-pproaches\">Comparing Approaches<\/a><\/span><span><a href=\"#h2-5--enchmark\">Benchmark<\/a><\/span><span><a href=\"#h2-6--onclusion\">Conclusion<\/a><\/span><\/div><\/div><!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<?xml encoding=\"utf-8\" ?><html><body><h2 id=\"h2-0--ntroduction\">Introduction<\/h2>\n<p>In this post, we dive into a more advanced topic: pointer arithmetic in Java. With the introduction of the Foreign Function &amp; Memory API (Panama), we can interact with native memory.<\/p>\n<p>Usually, when we work with off-heap memory, we use <code>MemorySegment<\/code> 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.<\/p>\n<h2 id=\"h2-1--ackground-nfo\">Background Info<\/h2>\n<p>I am working on a Project that creates bindings to [IO_Uring](<a target=\"_blank\" href=\"https:\/\/github.com\/davidtos\/JUring\" class=\"bare\">https:\/\/github.com\/davidtos\/JUring<\/a>). The project  has a path that loops over thousands of pointers and converts them to <code>MemorySegments<\/code>. This is done to access three values inside the struct the pointers point to. This loop creates a lot of short-lived Objects as I need a new  <code>MemorySegment<\/code> for each pointer. To prevent creating so many objects, I used the pointer arithmetic you see in this post.<\/p>\n<h3 id=\"h3-2--arning\">Warning<\/h3>\n<p>When using a global segment, we are trading safety for speed. This approach cannot detect if the memory backing the  pointer has been released or even is there to begin with.<\/p>\n<h2 id=\"h2-3--he-etup\">The Setup<\/h2>\n<p>To make this work, we need a way to access memory using addresses. In the following class, we define a simple \"Point\" structure (with x and y coordinates) and a special constant called <code>GLOBAL_MEMORY<\/code>.<\/p>\n<p>The <code>GLOBAL_MEMORY<\/code> acts as a view over the entire memory space. By creating a segment starting at address 0 and  explicitly allowing it to access a huge range, we can use any long address as an offset. This allows us to read  and write data just by knowing the memory address, bypassing the need to create a specific <code>MemorySegment<\/code> instance  for each pointer.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">import java.lang.foreign.GroupLayout;\r\nimport java.lang.foreign.MemoryLayout;\r\nimport java.lang.foreign.MemorySegment;\r\nimport java.lang.invoke.VarHandle;\r\nimport java.lang.foreign.ValueLayout;\r\n\r\npublic class ZeroGcPoint {\r\n\r\n    public static final GroupLayout LAYOUT = MemoryLayout.structLayout(\r\n            ValueLayout.JAVA_INT.withName(\"x\"),\r\n            ValueLayout.JAVA_INT.withName(\"y\")\r\n    );\r\n\r\n    \/\/ This acts as the base for all memory access.\r\n    private static final MemorySegment GLOBAL_MEMORY = MemorySegment.ofAddress(0L).reinterpret(Long.MAX_VALUE);\r\n\r\n    \/\/ These VarHandles know the offset within the struct for these fields\r\n    private static final VarHandle VH_X = LAYOUT.varHandle(MemoryLayout.PathElement.groupElement(\"x\"));\r\n    private static final VarHandle VH_Y = LAYOUT.varHandle(MemoryLayout.PathElement.groupElement(\"y\"));\r\n\r\n    \/\/ Get the value located at GLOBAL_MEMORY + address + X.\r\n    public static int getX(long address) {\r\n        return (int) VH_X.get(GLOBAL_MEMORY, address);\r\n    }\r\n\r\n    \/\/ Get the value located at GLOBAL_MEMORY + address + Y.\r\n    public static int getY(long address) {\r\n        return (int) VH_Y.get(GLOBAL_MEMORY, address);\r\n    }\r\n\r\n    \/\/ Setting the values without the need of a segment.\r\n    public static void set(long address, int x, int y) {\r\n        VH_X.set(GLOBAL_MEMORY, address, x);\r\n        VH_Y.set(GLOBAL_MEMORY, address, y);\r\n    }\r\n}<\/pre>\n<p>The magic and the danger lies in the <code>GLOBAL_MEMORY<\/code> constant. We create a segment starting at address 0 and use  <code>reinterpret<\/code> to extend its size to <code>Long.MAX_VALUE<\/code>. This effectively gives us a view over the entire system memory.<\/p>\n<p>Because our VarHandles are derived from the Layout, they expect a MemorySegment and an offset. By passing <code>GLOBAL_MEMORY<\/code> as the base segment and the address as the offset, we are telling Java: \"Start at 0, move forward by address, and read the data.\"<\/p>\n<h2 id=\"h2-4--omparing-pproaches\">Comparing Approaches<\/h2>\n<p>Now let&rsquo;s see how this compares to the standard way of accessing off-heap memory. In the following example, we allocate a  <code>ZeroGcPoint<\/code> inside an Arena and try two different approaches to read the data.<\/p>\n<p><strong>Approach 1<\/strong> represents the standard way. We take the address and reconstruct a MemorySegment from it. While safe and kind of the standard, this creates a new Java object, which adds pressure to the Garbage Collector.<\/p>\n<p><strong>Approach 2<\/strong> uses our <code>ZeroGcPoint<\/code> class. We simply pass the long address. Because we are using the static  <code>GLOBAL_MEMORY<\/code> inside the utility class, no new <code>MemorySegment<\/code> object is created during the access. This is effectively  pointer arithmetic in Java.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">import java.lang.foreign.Arena;\r\nimport java.lang.foreign.MemoryLayout;\r\nimport java.lang.foreign.MemorySegment;\r\nimport java.lang.invoke.VarHandle;\r\n\r\n\r\npublic class Main {\r\n    public static void main(String[] args) {\r\n        try (Arena arena = Arena.ofConfined()) {\r\n\r\n            MemorySegment pointSegment = arena.allocate(ZeroGcPoint.LAYOUT);\r\n            long rawAddress = pointSegment.address();\r\n            \/\/ setting the values\r\n            ZeroGcPoint.set(rawAddress, 10, 20);\r\n\r\n            System.out.println(\"Memory Address: \" + rawAddress);\r\n\r\n            \/\/ ==========================================================\r\n            \/\/ APPROACH 1: The Standard Way\r\n            \/\/ ==========================================================\r\n\r\n            VarHandle standardVhX = ZeroGcPoint.LAYOUT.varHandle(\r\n                    MemoryLayout.PathElement.groupElement(\"x\")\r\n            );\r\n            VarHandle standardVhY = ZeroGcPoint.LAYOUT.varHandle(\r\n                    MemoryLayout.PathElement.groupElement(\"y\")\r\n            );\r\n\r\n            MemorySegment retrievedSegment = MemorySegment.ofAddress(rawAddress).reinterpret(ZeroGcPoint.LAYOUT.byteSize());\r\n\r\n            \/\/ '0L' is the offset relative to the start of 'retrievedSegment'\r\n            int stdX = (int) standardVhX.get(retrievedSegment, 0L);\r\n            int stdY = (int) standardVhY.get(retrievedSegment, 0L);\r\n\r\n            System.out.printf(\"Uses  X: %d, Y: %d%n\", stdX, stdY);\r\n\r\n            \/\/ ==========================================================\r\n            \/\/ APPROACH 2: The Global way\r\n            \/\/ ==========================================================\r\n\r\n            int fastX = ZeroGcPoint.getX(rawAddress);\r\n            int fastY = ZeroGcPoint.getY(rawAddress);\r\n\r\n            System.out.printf(\"X: %d, Y: %d%n\", fastX, fastY);\r\n        }\r\n    }\r\n}<\/pre>\n<p>In the first approach, notice line 29 <code>MemorySegment.ofAddress<\/code>. We are explicitly asking the JVM to instantiate a new  MemorySegment object on the heap that wraps the native memory at that address. If you do this once, it&rsquo;s negligible.  If you do this inside a loop running thousands of times, you are generating a massive number of short-lived  objects that the Garbage Collector eventually has to clean up.<\/p>\n<h2 id=\"h2-5--enchmark\">Benchmark<\/h2>\n<p>Running a JMH benchmark shows the following performance improvement:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"text\">Benchmark       Mode  Cnt         Score       Error   Units\r\napproach2       thrpt    5  21009813.078 &plusmn; 98033.024  ops\/ms\r\napproach1       thrpt    5   1488555.237 &plusmn; 42608.652  ops\/ms<\/pre>\n<p>A higher score means it performs better.<\/p>\n<h2 id=\"h2-6--onclusion\">Conclusion<\/h2>\n<p>In this post, we looked at how to perform pointer arithmetic using the Foreign Function &amp; Memory API. By using a  global memory segment and addresses, we can access native memory without the overhead of creating temporary  <code>MemorySegments<\/code>.<\/p>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Table of Contents IntroductionBackground InfoWarningThe SetupComparing ApproachesBenchmarkConclusion Introduction In this post, we dive into a more advanced topic: pointer arithmetic in Java. With the introduction of the Foreign Function &amp; Memory API (Panama), we can interact with native memory. Usually, &#8230;<\/p>\n","protected":false},"author":687,"featured_media":122374,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1722],"tags":[1081,33],"class_list":["post-122286","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-ffm","tag-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pointer Arithmetic in Modern Java<\/title>\n<meta name=\"description\" content=\"How to perform pointer arithmetic using the Foreign Function &amp; Memory API to achieve zero-GC memory access.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pointer Arithmetic in Modern Java\" \/>\n<meta property=\"og:description\" content=\"How to perform pointer arithmetic using the Foreign Function &amp; Memory API to achieve zero-GC memory access.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"foojay\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-15T09:00:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-19T10:06:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/foojay.io\/wp-content\/uploads\/2026\/01\/jmh.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1498\" \/>\n\t<meta property=\"og:image:height\" content=\"320\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"David Vlijmincx\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"David Vlijmincx\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/pointer-arithmetic-in-modern-java\\\/\"},\"author\":{\"name\":\"David Vlijmincx\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/person\\\/d009d077452d932fea5ba84f4e420bcc\"},\"headline\":\"Pointer Arithmetic in Modern Java\",\"datePublished\":\"2026-01-15T09:00:12+00:00\",\"dateModified\":\"2026-01-19T10:06:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/pointer-arithmetic-in-modern-java\\\/\"},\"wordCount\":598,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/jmh.png\",\"keywords\":[\"FFM\",\"Java\"],\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/pointer-arithmetic-in-modern-java\\\/\",\"url\":\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/\",\"name\":\"Pointer Arithmetic in Modern Java\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/jmh.png\",\"datePublished\":\"2026-01-15T09:00:12+00:00\",\"dateModified\":\"2026-01-19T10:06:59+00:00\",\"description\":\"How to perform pointer arithmetic using the Foreign Function & Memory API to achieve zero-GC memory access.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/#primaryimage\",\"url\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/jmh.png\",\"contentUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/jmh.png\",\"width\":1498,\"height\":320},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/davidvlijmincx.com\\\/posts\\\/pointer-arithmetic-in-java\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/foojay.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pointer Arithmetic in Modern Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#website\",\"url\":\"https:\\\/\\\/foojay.io\\\/\",\"name\":\"foojay\",\"description\":\"a place for friends of OpenJDK\",\"publisher\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/foojay.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#organization\",\"name\":\"foojay\",\"url\":\"https:\\\/\\\/foojay.io\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/cropped-Favicon.png\",\"contentUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/cropped-Favicon.png\",\"width\":512,\"height\":512,\"caption\":\"foojay\"},\"image\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/foojay2020\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/person\\\/d009d077452d932fea5ba84f4e420bcc\",\"name\":\"David Vlijmincx\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/cropped-1702294371667-96x96.jpeg\",\"url\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/cropped-1702294371667-96x96.jpeg\",\"contentUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/cropped-1702294371667-96x96.jpeg\",\"caption\":\"David Vlijmincx\"},\"description\":\"Senior Java developer | Author | speaker | Oracle Ace | Blogger | 9+ YOE\",\"sameAs\":[\"https:\\\/\\\/davidvlijmincx.com\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/david-vlijmincx\\\/\"],\"url\":\"https:\\\/\\\/foojay.io\\\/today\\\/author\\\/david-vlijmincx\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pointer Arithmetic in Modern Java","description":"How to perform pointer arithmetic using the Foreign Function & Memory API to achieve zero-GC memory access.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Pointer Arithmetic in Modern Java","og_description":"How to perform pointer arithmetic using the Foreign Function & Memory API to achieve zero-GC memory access.","og_url":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/","og_site_name":"foojay","article_published_time":"2026-01-15T09:00:12+00:00","article_modified_time":"2026-01-19T10:06:59+00:00","og_image":[{"width":1498,"height":320,"url":"https:\/\/foojay.io\/wp-content\/uploads\/2026\/01\/jmh.png","type":"image\/png"}],"author":"David Vlijmincx","twitter_misc":{"Written by":"David Vlijmincx","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/#article","isPartOf":{"@id":"https:\/\/foojay.io\/today\/pointer-arithmetic-in-modern-java\/"},"author":{"name":"David Vlijmincx","@id":"https:\/\/foojay.io\/#\/schema\/person\/d009d077452d932fea5ba84f4e420bcc"},"headline":"Pointer Arithmetic in Modern Java","datePublished":"2026-01-15T09:00:12+00:00","dateModified":"2026-01-19T10:06:59+00:00","mainEntityOfPage":{"@id":"https:\/\/foojay.io\/today\/pointer-arithmetic-in-modern-java\/"},"wordCount":598,"commentCount":0,"publisher":{"@id":"https:\/\/foojay.io\/#organization"},"image":{"@id":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2026\/01\/jmh.png","keywords":["FFM","Java"],"articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/foojay.io\/today\/pointer-arithmetic-in-modern-java\/","url":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/","name":"Pointer Arithmetic in Modern Java","isPartOf":{"@id":"https:\/\/foojay.io\/#website"},"primaryImageOfPage":{"@id":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/#primaryimage"},"image":{"@id":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2026\/01\/jmh.png","datePublished":"2026-01-15T09:00:12+00:00","dateModified":"2026-01-19T10:06:59+00:00","description":"How to perform pointer arithmetic using the Foreign Function & Memory API to achieve zero-GC memory access.","breadcrumb":{"@id":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/#primaryimage","url":"https:\/\/foojay.io\/wp-content\/uploads\/2026\/01\/jmh.png","contentUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2026\/01\/jmh.png","width":1498,"height":320},{"@type":"BreadcrumbList","@id":"https:\/\/davidvlijmincx.com\/posts\/pointer-arithmetic-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/foojay.io\/"},{"@type":"ListItem","position":2,"name":"Pointer Arithmetic in Modern Java"}]},{"@type":"WebSite","@id":"https:\/\/foojay.io\/#website","url":"https:\/\/foojay.io\/","name":"foojay","description":"a place for friends of OpenJDK","publisher":{"@id":"https:\/\/foojay.io\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/foojay.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/foojay.io\/#organization","name":"foojay","url":"https:\/\/foojay.io\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/foojay.io\/#\/schema\/logo\/image\/","url":"https:\/\/foojay.io\/wp-content\/uploads\/2020\/04\/cropped-Favicon.png","contentUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2020\/04\/cropped-Favicon.png","width":512,"height":512,"caption":"foojay"},"image":{"@id":"https:\/\/foojay.io\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/foojay2020"]},{"@type":"Person","@id":"https:\/\/foojay.io\/#\/schema\/person\/d009d077452d932fea5ba84f4e420bcc","name":"David Vlijmincx","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/foojay.io\/wp-content\/uploads\/2025\/04\/cropped-1702294371667-96x96.jpeg","url":"https:\/\/foojay.io\/wp-content\/uploads\/2025\/04\/cropped-1702294371667-96x96.jpeg","contentUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2025\/04\/cropped-1702294371667-96x96.jpeg","caption":"David Vlijmincx"},"description":"Senior Java developer | Author | speaker | Oracle Ace | Blogger | 9+ YOE","sameAs":["https:\/\/davidvlijmincx.com","https:\/\/www.linkedin.com\/in\/david-vlijmincx\/"],"url":"https:\/\/foojay.io\/today\/author\/david-vlijmincx\/"}]}},"_links":{"self":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/posts\/122286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/users\/687"}],"replies":[{"embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/comments?post=122286"}],"version-history":[{"count":0,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/posts\/122286\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/media\/122374"}],"wp:attachment":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/media?parent=122286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/categories?post=122286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/tags?post=122286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}