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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:32:03+00:00 2026-06-11T23:32:03+00:00

How do i free up Memory? Say I have a string Dim TestStri As

  • 0

How do i free up Memory?

Say I have a string

  Dim TestStri As String
  TestStri = "Test"

  ' What do i have to type up to get rid of the variable?

  ' I know
  TestStri = Nothing
  ' will give it the default value, but the variable is still there.

Can I use the same Method for other variables i.e. Long, int etc.

  • 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-11T23:32:05+00:00Added an answer on June 11, 2026 at 11:32 pm

    I’m assuming you are referring to VB6 and VBA as indicated by your title, not VB.Net, as indicated by a keyword.

    In VB6 and VBA the memory consumption of a string variable consists of a fixed part for the string’s length and a terminator and a variable length part for the string contents itself. See http://www.aivosto.com/vbtips/stringopt2.html#memorylayout for a good explanation of this.

    So, when you set the string variable to an empty string or vbNullString, you will be freeing up the variable part of the string but not the fixed part.

    Other types like long, int, bool and date consume a fixed amount of memory.

    You can’t “free” local variables in VB completely (come to think of it, is there ANY programming language where you can do that?), and for the most part, you wouldn’t care because the local variables themselves (the fixed portion) is usually very small.
    The only case I can think of where the memory consumption of local varibles could get big is if you have recursive function calls with deep recursion/wide recursion.

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

Sidebar

Related Questions

I'm trying to free memory that's reallocated but I get an error... float *
i'm trying to get the actual free memory. It seems to be the easiest
Can some suggest a good a free memory profiling tool which will show memory
Possible Duplicate: Return value from thread I want to get the free memory of
Just curious. If you have 4Gb of free memory and you create 10k of
Operating System question: Say we have a process running in a paged memory system,
Say I have the below code: program test call foo call foo contains subroutine
Let's say you have a type T and subtypes TSub1 , TSub2 etc. Several
When I have a class containing static stuff, how can I free the memory
here's a problem with memory management issue. Say i have a view A, it

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.