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 811003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:58:28+00:00 2026-05-15T00:58:28+00:00

FlexBuilder’s debugger will show you the memory location (or, I can only assume, something

  • 0

FlexBuilder’s debugger will show you the “memory location” (or, I can only assume, something roughly analogous) of any in-scope instance:

debugger memory location

But I’d like to get this information in code (sort of like Python’s id function), so I could very easily trace how objects move through out the system. For example, I might have:

trace("Returning", id(foo));

Then somewhere else I could use:

trace("Using", id(foo));

To make sure both bits of code are dealing with the same instance.

Now, I know that many AS classes implement the IUID interface… But there are also a bunch of classes which don’t (plain old arrays and objects, for example), so that wouldn’t solve my problem.

I realize that I could also wrap objects in an ObjectProxy, but that would be less than ideal as well.

  • 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-05-15T00:58:28+00:00Added an answer on May 15, 2026 at 12:58 am

    In realy I advise to you don’t to use this too much… it is very expensive. Adobe need to create a native function to return this to us.

    But, for now… try this:

    You will need to cause a explicit coercion to get it!
    Because when you make and explicit coercion you get an Error like this:

    TypeError: Error #1034: 
    Type Coercion failed: cannot convert Main@1c49d31 to flash.utils.ByteArray.
    
    

    Note that in this error you get what you want… the @1c49d31. This hash is like an ID in the memory allocation.

    I did a lot of tests. This hash just change when you call a “new” (in C languages is equivalent to [[… alloc] init]) and for static functions and static properties, the allocation occurs a little different… anyway…

    Backing to Flash, the problem is we don’t have a direct way to get this hash without an Error.

    But this is not a realy big problem. All that you need is to use some “try” and “catch”
    Like this:

    try
    {
        ByteArray(anyObjectToKnowItAllocationHash);
    }
    catch (e:Error)
    {
        trace(e);
    }
    

    And voila!
    You will get the hash without result in an Error!
    After this I did a more refinated way… Try this:

    var memoryHash:String;
    
    try
    {
        FakeClass(anyObjectToKnowItAllocationHash);
    }
    catch (e:Error)
    {
        memoryHash = String(e).replace(/.*([@|\$].*?) to .*$/gi, '$1');
    }
    
    internal final class FakeClass { }
    

    A little explain about this:
    The fakeClass is to be sure about this will generate an Error.
    The RegularExpression is to capture the last @… that appear. Because Objects and Functions generate different messages on this Error. And the $ is to catch the Static Objects, Class and Functions, bacause they don’t have an “@” in its memory hash and different zones in memory.

    This little code works so fine to me! Now i can finish some great engines that i’m making that work with memory management, weak references and ID based on memory.

    I hope this can help you.

    Bye, and good luck, my friend!

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

Sidebar

Related Questions

In flexbuilder 3 for some mxml files I can purposely put in syntax errors
As the title suggests, is there any documentation on the FlexBuilder expressions tab, and
Is there something like regions in FlexBuilder?
Good Morning, I have a very odd error working in adobe flexbuilder 3. Ever
I am using the Flex Builder 3 debugger almost every day and it's starting
Can I create an application with Flex Builder Trial ( that I have just
I have Flexbuilder installed, with SDK 3.2. I wanted to try upgrade my SDK
My flex builder suddenly stopped highlighting compile time errors. Its also not giving any
This is with Flexbuilder 3.2, Eclipse 3.3.2. I am moving my development environment to
I am not using FlexBuilder, I'm using the free Flex SDK with TextMate .

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.