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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:14:48+00:00 2026-06-14T01:14:48+00:00

i have some code where I use arrays to hold large amounts of data(sometimes

  • 0

i have some code where I use arrays to hold large amounts of data(sometimes over 1million data points), I use arrays because they can be dynamically defined in 2 directions and are able to insert values at a specific position. However I found that when I use Redim to change to dimensions of the array it creates a duplicate of the array in the RAM causing me to eventually run out of RAM. I have found that Erase can be used to remove the array and save RAM, then I can use Redim to create a new array. However this means I have no where to hold my data in the mean time, unless I create a second array and manually copy the data across.

Is there a way to Redim an array to without losing RAM but with a more efficient way of hold the data rather than manually copy to a new array and back again. Or is there another class I can use to hold the data instead of an array that fulfills the requirements above.

Please ask for sample code if you would like some.

Many thanks for your help

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

    Using an array in this way is not very memory efficient.

    You would be better to use a List(of T) Have a look at this answer for reasons why

    In this case you can use a class to hold each data point. Using a List(of T) allows you to insert into the middle of the list without a copy of the entire data being created.

    'Define your datapoint class
    Private Class DataPoint
        Public Property X As Long
        Public Property Y As Long
        Public Sub New(ByVal X As Long, ByVal Y As Long)
            Me.X = X
            Me.Y = Y
        End Sub
    End Class
    
    'create and initialise the list
    Dim MyDataPoints As New List(Of DataPoint)
    'add some data to it
    MyDataPoints.Add(New DataPoint(1, 2))
    MyDataPoints.Add(New DataPoint(1, 2))
    MyDataPoints.Add(New DataPoint(4, 3))
    'Now insert a new datapoint at an arbitrary position in the list
    MyDataPoints.Insert(2, New DataPoint(5, 6))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this bit of code to feed some data i have parsed from
I have some code where I use a thread static object in C#. [ThreadStatic]
I have some code that I use in both my Worker Role and Web
I have some code that makes heavy use of a thread pool, which I
Question simple and quick: I have started to use Netbeans to write some code
We have a J2EE app built on Struts2+spring+iBatis; not all DAO's use iBatis...some code
I have the next code to retrieve some data from a xml file. The
I have written some code that stores values inside a array of arrays. I
I have written some code which extracts and invoice from various hashes, arrays, arrays
am having problem in Saving some data in my Java code. I have like

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.