FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Memory growing after every click

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Tue Dec 09, 2008 11:50 pm    Post subject: Memory growing after every click Reply with quote

Greetings and salutations!

I have this piece of code:
Code:
  private void getOpenProjects(ListView lv)
  {
    //DisplayProgressBar("start");
    ini = GetIniValues();
    //msgBox(ini.rPath);
    EveryoneChecked();
    MessageBeep(1);
    OpenProjDisplay = true;
    btnNew.enabled  = true;
    btnDelete.enabled  = true;
    btnSave.enabled  = false;
    btnDelete.enabled  = false;
    btnCopy.enabled  = false;
    RptPrefix = "Open Projects List";
    lv.focus();
    if (ini.stop)
      return false;
    lv.clear();
    char[] q = null;
    q = r"SELECT * FROM LSOpenProjects
            WHERE PClass=' Project' AND PSubClass=' Project' AND status != 'c'
            ORDER BY ProjID, PClass, PSubClass, bdate, ddate, edate; ";
    //msgBox(q);
    //_LogToASCIIFileWithTime("query.txt",q,__LINE__);
    if (Everyone.checked)
    {
      EveryoneChecked();
      dba = new SqliteDatabase(sqldba);
      Rows = dba.queryFetchAll(q);
      dba.close();
    }
    else
      Rows = db.queryFetchAll(q);

    PrepareListView(lv, Rows);
    //msgBox(std.string.toString(Rows.length));

    info.text     = myMsg; // ~ std.string.toString(Rows.length) ~ " open Projects found.";
    //myMsg         = std.string.toString(Rows.length) ~ " subProjects found.";
    error.text    = errMsg;
    FromGetProjectChildren = false;
    PMTimeToday.text = calculatePMTimeToday();
  }


That calls this other function

Code:
  protected void PrepareListView(ListView lv, Row[] Rows)
  {
    char[][] c;
    int proj = 0;
    lv.clear();
    foreach (Row row; Rows)
    {
      char[] cc;
      c = Row2CharArray(row);
      if (c[9] == " Project")
        proj++;
      lv.addRow(c);
    }
    if(lv.items.length)
      lv.ensureVisible(lv.items.length - 1);
   
    //lv.activation(1);
    myMsg = "Found " ~ std.string.toString(proj) ~ " projects ";
  }

The problem is that every time the "getOpenProjects" function is called by clicking the getOpenProjects button, the memory keeps growing, even though that is the only thing I am doing. I have done a bunch of changes to make sure that it is not my program that is adding the memory, though it could be, but how can I find out why the memory keeps growing by clicking the function? How can I reset it before every display?

thanks,

jose
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Wed Dec 31, 2008 10:25 pm    Post subject: Re: Memory growing after every click Reply with quote

If autoCollect is on, DFL will call the GC every once in a while. Otherwise, memory usage may climb a bit until the GC itself thinks it's a good time to collect.
However, it still may be possible that there is a memory leak in your garbage collected application. One example directly related to DFL is if you showDialog and do not dispose, it may get leaked. There are other general ways; you can search the D newsgroups for particular cases.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group