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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:46:34+00:00 2026-05-11T08:46:34+00:00

I have been developing for some time now, and I have not used pointers

  • 0

I have been developing for some time now, and I have not used pointers in my development so far.

So what are the benefits of pointers? Does an application run faster or uses fewer resources?

Because I am sure that pointers are important, can you “point” me to some articles, basic but good to start using pointers in Delphi? Google gives me too many, too special results.

  • 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. 2026-05-11T08:46:35+00:00Added an answer on May 11, 2026 at 8:46 am

    A pointer is a variable that points to a piece of memory. The advantages are:

    • you can give that piece of memory the size you want.
    • you only have to change a pointer to point to a different piece of memory which saves a lot of time copying.

    Delphi uses a lot of hidden pointers. For example, if you are using:

    var   myClass : TMyClass; begin   myClass := TMyClass.Create; 

    myClass is a pointer to the object.

    An other example is the dynamic array. This is also a pointer.

    To understand more about pointers, you need to understand more about memory. Each piece of data can exist in different pieces of data.

    For example global variables:

    unit X;  interface  var   MyVar: Integer; 

    A global variable is defined in the datasegment. The datasegment is fixed. And during the lifetime of the program these variables are available. Which means the memory can not be used for other uses.

    Local variables:

    procedure Test; var   MyVar: Integer; 

    A local variable exists on the stack. This is a piece of memory that is used for housekeeping. It contains the parameters for the function (ok some are put in a register but that is not important now). It contains the return adress so the cpu knows where to return if the program has ended. And it contains the local variables used in the functions. Local variables only exists during the lifetime of a function. If the function is ended, you can’t access the local variable in a reliable way.

    Heap variables:

    procedure Test2; var   MyClass: TMyClass; begin   MyClass := TMyClass.Create; 

    The variable MyClass is a pointer (which is a local variable that is defined on the stack). By constructing an object you allocate a piece of memory on the heap (the large piece of ‘other’ memory that is not used for programs and stacks). The variable MyClass contains the address of this piece of memory. Heap variables exist until you release them. That means that if you exit the funcion Test2 without freeing the object, the object still exists on the heap. But you won’t be able to access it because the address (variable MyClass) is gone.

    Best practices

    It is almost always preferably to allocate and deallocate a pointer variable at the same level.

    For example:

    var   myClass: TMyClass; begin   myClass := TMyClass.Create;   try     DoSomething(myClass);     DoSomeOtherthing(myClass);   finally     myClass.Free;   end; end; 

    If you can, try to avoid functions that return an instance of an object. It is never certain if the caller needs to dispose of the object. And this creates memory leaks or crashes.

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

Sidebar

Ask A Question

Stats

  • Questions 227k
  • Answers 227k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You want to use :contains. $('td:contains("Dolares")').addClass('highlight'); for the parent $('td:contains("Dolares")').parent().addClass('highlight'); May 13, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Read the documentation on optparse. It is very powerful and… May 13, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer MyEnum type = MyEnum.ValueIWant; var filtered = items.Where(p => p.Type… May 13, 2026 at 1:19 am

Related Questions

What are your opinions and experiences regarding using TDD when developing an user interface?
I have been developing with objective C and the Cocoa framework for quite some
Summary I recently had a conversation with the creator of a framework that one
I've been developing web applications for 2 years now, and have been into simpler

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.