Simple memory usage question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M O J O

    Simple memory usage question

    Hi,

    A simple question...

    This is just an example ... Say I have a class (MyClass) that has only
    few variables (let's say 10 strings) but many-many-many subs and
    fuctions, so many subs and functions that they take up 10k of memory.
    The subs and fuctions creates no new variables.

    Here's my question....

    Will ....

    Dim Class1 As New MyClass
    Dim Class2 As New MyClass
    Dim Class3 As New MyClass

    Will they use 30k (due to the subs & functions) plus a small usage for
    the 30 strings? .... or will they only use 10k plus a small usage for
    the 30 strings?

    In other words ... Will creating a new MyClass take 10k plus the strings
    each time I create a new instance or will it only take 10k (plus the
    strings) the first time I create an instance and all other instances
    will use the same 10k of subs ans functions?

    Than you!

    M O J O

  • Herfried K. Wagner [MVP]

    #2
    Re: Simple memory usage question

    * M O J O <mojo@_no_spam_ delete_this_new websolutions.dk > scripsit:[color=blue]
    > This is just an example ... Say I have a class (MyClass) that has only
    > few variables (let's say 10 strings) but many-many-many subs and
    > fuctions, so many subs and functions that they take up 10k of
    > memory. The subs and fuctions creates no new variables.
    >
    > Here's my question....
    >
    > Will ....
    >
    > Dim Class1 As New MyClass
    > Dim Class2 As New MyClass
    > Dim Class3 As New MyClass
    >
    > Will they use 30k (due to the subs & functions) plus a small usage for
    > the 30 strings? .... or will they only use 10k plus a small usage for
    > the 30 strings?[/color]

    The latter.

    --
    Herfried K. Wagner [MVP]
    <http://www.mvps.org/dotnet>

    Comment

    • M O J O

      #3
      Re: Simple memory usage question

      Thanks Herfried!!

      M O J O

      Herfried K. Wagner [MVP] wrote:
      [color=blue]
      > * M O J O <mojo@_no_spam_ delete_this_new websolutions.dk > scripsit:
      >[color=green]
      >>This is just an example ... Say I have a class (MyClass) that has only
      >>few variables (let's say 10 strings) but many-many-many subs and
      >>fuctions, so many subs and functions that they take up 10k of
      >>memory. The subs and fuctions creates no new variables.
      >>
      >>Here's my question....
      >>
      >>Will ....
      >>
      >>Dim Class1 As New MyClass
      >>Dim Class2 As New MyClass
      >>Dim Class3 As New MyClass
      >>
      >>Will they use 30k (due to the subs & functions) plus a small usage for
      >>the 30 strings? .... or will they only use 10k plus a small usage for
      >>the 30 strings?[/color]
      >
      >
      > The latter.
      >[/color]

      Comment

      • Gary Chang

        #4
        Re: Simple memory usage question

        Hi, M O J O,

        Thanks for using Microsoft MSDN Managed Newsgroup.

        It seems you have got the answer by MVP Herfried's reply, If you more
        concerns on this topic, please feel free to reply this message, I will find
        someone to help you on your issue.

        Thanks!


        Best regards,

        Gary Chang
        Microsoft Online Partner Support

        Get Secure! - www.microsoft.com/security
        This posting is provided "AS IS" with no warranties, and confers no rights.
        --------------------

        Comment

        Working...