Re: [Vala] User managed memory?



Use list = NULL

but if there are no references for list outside
this function it will be automatically freed, so
the null assignation will not be necessary.

On Fri, 14 Nov 2008 09:07:33 +0200
"Kaan Yamanyar" <kaan yamanyar com> wrote:

Hi,

I appreciate wonderful work you are dealing with. I was looking for similar
idea for Java then I suddenly came face-to-face with this project.

I hope to see a better eclipse plug-in which integrates easily with full
support such syntax highlighting, building, debugging and it is for windows.

Also, I wonder: If you define (if you had not defined already) a keyword
like "delete" for memory management (so the developer is fully responsible
for memory management), would performance be better? (Please see added line
21 to your List Example below:)

KR,
Kaan Yamanyar

01 using GLib;
02
03 public static int main (string[] args) {
04    List<string> list = new List<string> ();
05    list.append ("one");
06    list.append ("two");
07    list.append ("three");
08
09    stdout.printf ("list.length () = %u\n", list.length ());
10
11    // Traditional iteration
12    for (int i = 0; i < list.length (); i++) {
13        stdout.printf ("%s\n", list.nth_data (i));
14    }
15
16    // Comfortable iteration
17    foreach (string element in list) {
18        stdout.printf ("%s\n", element);
19    }
20
21    delete list; //USER MANAGED MEMORY ??
22    return 0;
23 }



  --pancake



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]