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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T09:01:51+00:00 2026-05-17T09:01:51+00:00

My question is about memory use and objects in actionscript 2. If I have

  • 0

My question is about memory use and objects in actionscript 2. If I have a class definition:

class test1{
    public function one(){trace("Hello");}
    public function two(){trace("World");}
}

And a second class definition:

class test2{
    static public function one(){trace("Hello");}
    static public function two(){trace("World");}
}

And then I do the following:

var object1a = new test1();
var object1b = new test1();

var object2a = new test2();
var object2b = new test2();

Is the size of object1a + object1b greater than the size of object2a + object2b because of the functions not being static (and possibly being copied into each object instantiation)? I do not have Actionscript 3 to detect memory use, maybe someone can check how this behaves in AS 3 if it is difficult to determine in AS 2.

I’m just wondering if non-static member functions are all references to the single prototype definitions, or if they are copied wholesale into each function effectively doubling memory use for test1 vs test2. I imagine they are treated as references and then overriding them simply changes the reference to a different function in memory, but I am not sure and would like a bit of clarification.

Thanks!

  • 1 1 Answer
  • 2 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-17T09:01:58+00:00Added an answer on May 17, 2026 at 9:01 am

    Non static properties (alias fields, alias member variables) have their own copy for each object instance of a class.

    Methods, whether static or not, only exist in one copy for each class.

    That makes sense, if you think about it: there’s no reason to copy a behaviuor that doesn’t change. Only the status (variables) do change.

    The only difference I can think about between static and non-static methods is the visibility level, that is a non-static method “sees” the object status, while a static method can’t because it works on a class level.

    edit (prove):

    AClassStatic.as
    class AClassStatic
    {
        public static function f():Void  { return ; }
        public static function g():Void  { return ; }
            public static function h():Void  { return ; }
    }
    
    
    AClass.as
    class AClass
    {
        public function f():Void { return ; }
        public function g():Void { return ; }
        public function h():Void { return ; }
    }
    
    test.fla
    import AClass
    import AClassStatic
    
    var obj1:AClass  = new AClass ();
    var obj2:AClassStatic = new AClassStatic ();
    
    if ( sizeof(obj1) == sizeof(obj2) )
        trace("equal");
    

    I have created 10,000 objects of AClass and measured that the executable occupies 6304 Kbyte, while creating 10,000 AClassStatic objects needs 6284 KB. It is different, but irrelevant.

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

Sidebar

Related Questions

I'm developing an iPhone app and have a question about memory management. Let's say
I have a question about structure padding and memory alignment optimizations regarding structures in
I've a question about the memory management in C (and GCC 4.3.3 under Debian
My question is about pointing to chunks of memory of an odd size. Let's
This question is not about caching. I need this in-memory table for many small
I have some questions about using MySQLi queries, and related memory management. Suppose I
Question about subclassing in matlab, under the new class system. I've got class A
Question about GridView sorting in VB.NET: I have a GridView with AutoGenerateColumns = True
This is an open question towards learning about memory optimization and code optimization for
I'm unsure about whether to use a mutable struct or a mutable class. My

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.