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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:41:15+00:00 2026-06-13T15:41:15+00:00

According to this Vala doesn’t have garbage collection. It does reference counting. I’m not

  • 0

According to this

Vala doesn’t have garbage collection. It does reference counting.

I’m not exactly sure what the difference is between garbage collection and reference counting nor could I find a clear explanation.
Do I explicitly need to delete bmp and/or add a destructor to class Bmp?
IOW: does this code have a memory leak?

public void* run() {
    while(true) {
        if(detected) {
            ...
            var bmp = new Bmp(800,800);
            ...

public class Bmp {
    ...
  • 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-13T15:41:16+00:00Added an answer on June 13, 2026 at 3:41 pm

    The code you have written is not a memory leak, but it is possible to write one. For instance:

       class Foo {
           Foo? f;
       }
       var foo1 = new Foo();
       var foo2 = new Foo();
       foo1.f = foo2;
       foo2.f = foo1;
    

    Every time a Foo is assigned, a counter for that instance is incremented and decremented when it is unassigned. Because foo1 and foo2 have references to each other, their counts will never go to zero, even if there are no references to them in the rest of the program. The unowned keyword makes a reference that not counted. So, a dangling pointer can be written as follows:

    var foo = new Foo();
    unowned Foo f = foo;
    foo = null;
    // f now refers to an object that has been deallocated.
    

    If your object graph has no cycles, there will be no problem. If you have any circular references, you may leak memory if you do not clean up properly.

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

Sidebar

Related Questions

According to this: http://www.xmlplease.com/xquery-xhtml XQuery does not have a standard way of setting the
According to this MSDN article , you should not catch general exceptions. I'm sure
I have trying to install nhibernate according this tutorial, but it doesn't say where
According to this article I know, that DateTimePicker control does not reflect CurrentUICulture So,
According to this link xmlhttp.responseText not display text . I have another problem about
I have made a custom suface button according this example: <Button> <Button.Template> <ControlTemplate TargetType=Button>
According to this link: http://forums.silverlight.net/t/20489.aspx encrypting a XAP file is not possible. However, obfuscating
According to this reference , there are two escape sequences \n and \num where
According to this discussion , the iphone agreement says that it doesn't allow loading
According to this http://www.cplusplus.com/reference/clibrary/csignal/signal.html SIGINT is generally used/cause by the user. How do i

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.