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

  • SEARCH
  • Home
  • 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 9212537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:32:49+00:00 2026-06-18T01:32:49+00:00

I made a simple library for measuring the size of a given object. The

  • 0

I made a simple library for measuring the size of a given object. The library is
accessed through JNI from a Java class. It’s specifically designed for Hotspot, thus it uses the JVMTI and it calls GetObjectSize.

My question is, what’s the better solution?

  1. To load the library using System.load("library") or

  2. to set the library as an agent and explicitly load it by issuing the java command with the agent option.

All similar examples I’ve seen so far employ the agent function:

  • Determine Java class size from JNI jclass
  • How to calbulate the size of an object

In what way is that more efficient than just loading the library?

Thanks!

  • 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-18T01:32:51+00:00Added an answer on June 18, 2026 at 1:32 am

    The advantage of command-line injection, is that the agent is loaded together with the Virtual Machine. You can inject the agent into every Java program without modifying the program. With System.load that this done at the point of invocation. You can react to a bigger set of callbacks, for instance there is a VM Initialization Event. If you use System.load that event is bygone.

    As a result, I do not believe that using command-line injection is so much more efficient in a cetain way, but rather more effective for some use cases.

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

Sidebar

Related Questions

I'm using this simple code: http://ejohn.org/blog/simple-javascript-inheritance/ Using this library, I made this simple class:
Here's the deal. I'm just starting with Java programming, I've made a simple application
Real simple, made this windows service: http://msdn.microsoft.com/en-us/library/zt39148a.aspx Installed it, console shows no problems, navigate
I was going through this software library for semantic specs in java. This particular
I've made very simple wrapper for unmanaged C++ library (to be used with C#).
I've been goobing around with FreePascal and made a simple test DLL. library dll;
I created this class library(ReportLib) with a simple Telerik report using Telerik Reporting Wizard.
I have a 32 bit .NET class library having a simple public class and
I made a simple program for my friends using some things from the os
I have made a sample for posting on Facebook using the basic Facebook library

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.