Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8498179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:19:52+00:00 2026-06-11T00:19:52+00:00

I have an array of objects in Java and I want to allow native

  • 0

I have an array of objects in Java and I want to allow native C code direct access to that array (no copying or accessor functions). Is this possible? I don’t mind if the solution is JVM-specific.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:19:53+00:00Added an answer on June 11, 2026 at 12:19 am

    I finally found an answer. It is generally not possible to do what I wanted with JNI. However, some VMs provide the needed functionality, I used JikesRVM:

    1) The native code needs the memory location of the array. This can be achieved using the ‘Magic’ facility in JikesRVM, it provides an ObjectReference and an Address class that allow to obtain a memory address for each object. This address can then be forwarded to the native code as long/int argument (using JNI) and there casted to a pointer.

    2) The GC may not move objects around. This is a bit more tricky since it requires support for pinning in the GC. In the case of JikesRVM, objects can be annotated with @NonMoving and @NonMovingAllocation (also part of ‘Magic’). Furthermore, objects (i.e. arrays) > 8KB are placed in a Large Object Space, which doesn’t move objects around.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of java objects. Each object stores two longs that define
I have a class that contains an array. I want this array to be
I have an array list that contains Quote objects. I want to be able
I have an array of objects and I want to add another object just
I have an array of objects that have QTTime structs as attributes. The objects
I have an array of objects, and want the objects to be able to
I have an array of objects[] but I want to convert them to an
I have an array of different objects with different data types I want to
How can I filter an array in Java? I have an array of objects,
In a Java program, I have an array of objects. Each object has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.