Re: [Vala] Vala syntax file for Midnight Commander editor
MANY thanks for this! ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Launched version 1.14 of Autovala
> I just tried autovala(Ubuntu 18.04), but getting an error. Witch packet > is missing? > /usr/include/readline/readline.h must exist to compile this project. libreadline-dev ? ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Newbie need help
Or try this: First, install packages: sudo apt install tcc libgtk-vnc-2.0-dev Second, try this VNC client script: #!/usr/bin/vala --Xcc=-w --cc=tcc --pkg gtk+-3.0 --pkg gtk-vnc-2.0 int main (string[] args) { Gtk.init (ref args); var window = new Gtk.Window (); window.destroy.connect(Gtk.main_quit); var vncDisp = new Vnc.Display(); window.add(vncDisp); vncDisp.open_host("your-vnc-host-name", "5900"); window.show_all(); Gtk.main(); return 0; } Cool, eh? ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Newbie need help
> valac -> compiler(ok) > vala -> interpreter what/how/usage As others said before, /usr/bin/vala is a command for using in Vala scripts. It compiles the embedded script code on the fly to a temporary binary and runs it afterwards. Additionally, I'm using tcc (Ubuntu: sudo apt install tcc) instead of the default gcc, because it compiles much faster (at the cost of bigger/slower binary, but scripts are usually not that large). Minimal Gtk example script (using tcc): #!/usr/bin/vala --Xcc=-w --cc=tcc --pkg=gtk+-3.0 using Gtk; int main(string[] args) { Gtk.init (ref args); var window = new Window (); window.destroy.connect (Gtk.main_quit); window.show_all (); Gtk.main (); return 0; } Save it into a file and use something like "sudo chmod a+x" on it and you may call it afterwards directly as a script. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] C# Developer
> If a C# developer really (not only for fun) to change to Vala, then must > necessarily be a valadevelop available! > With completion and tooltips and and and. Agreed, we need a good Vala IDE. > I have already tried a few, but all do not meet the expectations > (Geany/Anjuta/builder) > The already existing tools are nice, but that's not enough. Maybe Gnome Builder ist on the right track but there are some things left to do for optimum Vala IDE experience. Maybe some ElementaryOs developer is able and willing to push it a little bit? > What happened to the project Valaide? Unfortunately, no progress on Valaide since 2012 and little overall progress on the site (tarnyko.net) sinces years. Valaide is not even compilable anymore :-( > In C# you can easily call C methods to improve performance. mono have a C > bridge in both directions.. Vala calls C methods directly without any overhead or glue code ;-) Of course, same on the other way around. > I mean, certainly other C# developers too, that to develop seriously their > own "valadevelop" must be available. Yes, a good Vala IDE would speed up the development process and will push Vala. Maybe improving Gnome builder Vala integration is the right way? ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] printf question
> /home/wolfgang/Projekte/TestSqlite/application.vala:192:33: warning: format > ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type > ‘gint64 {aka long int}’ [-Wformat=] > But still the question is not answered ;-) No warning with valac 0.30 (Ubuntu 16.04), so can't help any further (maybe use --disable-warnings meanwhile LOL) ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] printf question
> cellRendererText.text = ("%"+int64.FORMAT).printf((int64)obj); << > int64.FORMAT = "li" > > this works, > > but when i try this, witch is the same > cellRendererText.text = ("%li").printf((int64)obj); > > i get thiss error > > application.vala:192.45-192.54: error: Argument 1: Cannot convert from > `int64' to `long' What about "%lld" ? ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Newbie need help
> You can use mono without recompile anything on other cpu's, including > ARM/MIPS !!! > I have a project for SetTopBoxes witch runs on Arm32/Mips32 with the same > dll's (AnyCPU) Of course, because it's managed (byte) code, something like java vm code. Does it run on any OS (Windows, Linux?)? > No, maybe I'm too stupid to do that > With Geany my project (4 files) compiles/build only one vala-file :-( Put something like this to "Build - Set Build Commands- Compile": valac --pkg gtk+-3.0 *.vala -o mybinary You may/should use a makefile for bigger projects. Please PM (private email, german) me and i will send you a generic makefile. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Newbie need help
> I wanted to try porting a bigger C# project to vala (performance/etc.) but i > think this is not a good idea. Indeed, it is. > As long as I have to deal with > buildsystem/ctags/plugins/autocomplete/whatever and not with my actual > work > It just wastes my time. But you have already managed it? > So thank's a lot for help, but back to monodevelop ... :-( Mind that Vala code is MUCH smaller and faster (and don't need any byte of additional library code) and Vala is constantly evolving (regardless of the nonsense E. B. babbled). Also, Vala is an official Gtk3 language binding, Gtk# is not (see https://www.gtk.org/language-bindings.php). We switched from Qt to Vala/Gtk/Glib (not the other way around!) several years ago and it was the best decision we ever made. One of our apps has approx. 300kLOC and was intended to run on PCs, but now also runs unmodified (only recompiled for ARM) perfectly on a Raspberry Pi. Please don't try this using Mono because your Raspi will detonate ;-) ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Newbie need help
Hi, > I used geany/geany-plugins from git, now debugger works fine ;-) Perfect. > So maybe last problem/question ;-) NP, ask as much as you want. We need new Vala warriors ;-) > "autocompletion" works with vala? If, i can't get it work Primary, geany does autocompletion based on opened files. So simply open all your project vala files within Geany. Secondary, install geany tags for autocompletion: * get from http://wiki.geany.org/tags/start * unzip to ~/.config/geany/tags * restart Geany ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Newbie need help
> THERE IS NO DEBUGGER -> Ubuntu 18.04 Calm down man, we will survive it ;-) > Witch distri do you use? Mine is Ubuntu 16.04. Tried on 18.04 recently and unfortunately you are right: there is no package geany-plugin-debugger :-( Take a look at https://askubuntu.com/questions/1068430/geany-plugin-debugger-missing-in-ubuntu-18-04 Meanwhile, you may use nemiver (sudo apt-get install nemiver) started from Geany "Build - Set Build Commands - Execute Commans - Run" using "nemiver %f" or something. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Newbie need help
> I tried, but ubuntu has no debugger plugin ☹ sudo apt-get install geany geany-plugins geany-plugin-addons devhelp Restart Geany and activate it via "Tools - Plugin Manager - Debugger". For the "HighlightSelectedPlugin", which is very convenient, try this: * Download http://sourceforge.net/projects/geanyhighlightselectedword * unzip to some directory and cd to it * make * sudo cp *.so `pkg-config --variable=libdir geany`/geany * Restart Geany and activate it via "Tools - Plugin Manager - GeanyHighlightSelectedWord" ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Newbie need help
Hi Wolfgang, I'm using Geany and the "Debugger" and the "GeanyHighlightSelectedWord" plugins. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] any latest vala binary for windows?
Hi Daniel, Im compiling Vala on Windows since years without any problems. Maybe the following "receipe" will help: Note: Use Win7 and above Note: I'm using the 32 Bit MSYS2 version for some reason Note: I'm using the same versions of Vala and Gee as on my Ubuntu 16.04 * Get MSYS2: http://repo.msys2.org/distrib/i686/msys2-i686-20180531.exe * Start the MSYS2 exe and install to C:\msys * Start c:\msys\msys2.exe * pacman -Syu * Close MSYS window * Start c:\msys\msys2.exe again * pacman -Syu * pacman -S gcc make tar glib2-devel base-devel * wget --no-check-certificate https://download.gnome.org/sources/vala/0.30/vala-0.30.1.tar.xz * tar xJf vala-0.30.1.tar.xz * cd vala-0.30.1 * ./configure * make * make install * valac --version * wget --no-check-certificate https://download.gnome.org/sources/libgee/0.18/libgee-0.18.0.tar.xz * tar xJf libgee-0.18.0.tar.xz * cd libgee-0.18.0 * ./configure * make * make install Regards, Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] [vala] problem with sorting an array
Hi, > I don't understand why I can't sort my array... :-/ (glib.array) seems this is a GLib.Array compare function binding (vapi) error or something like this. On C level, the compare objects are putted into your compare function as pointers to pointers and not as pointers. For a quick and dirty workaround, change the following two lines: int sort_by_size(ref FileAndChunks o1, ref FileAndChunks o2) { ... } list.sort((CompareFunc)sort_by_size); Note that after vapi fix, your code is broken again so it would be better to fix the vapi file instead of the above workaround. Regards, Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Vala book done (it's been only 10 years…)
Cool stuff! You absolutely should add a link to the book at https://en.wikipedia.org/wiki/Vala_(programming_language) https://de.wikipedia.org/wiki/Vala_(Programmiersprache) ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Using databases with Vala
Hi Oliver, I'm using a VERY thin (2-3 pages of code) self-written vala wrapper which hides open/close and query (returning a 2 dimensional string array as the result) using the Mysql and Sqlite Namespaces. Then, I only send SQL queries and process the result. Of course I only use basic SQL queries present in both database engines. This solution is very simple and surprisingly useful. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] What is the internal access specification (Re: A couple of Vala questions)
> Does 'internal' hook into the Vala package system, meaning internal > members cannot be accessed from a different package ? See Vala tutorial (https://wiki.gnome.org/Projects/Vala/Tutorial): internal: Access is limited exclusively to classes defined within the same package ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Package `Gee-0.8' not found
Hi Ralf, > $ valac --pkg Gee-0.8 list.vala use "valac --pkg gee-0.8 list.vala" (case sensitive). Additionally, install Gee for ubuntu this way: sudo apt install libgee-0.8-dev ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Books and Guides for VALA-GTK-Networking Development
Hi Hans, try https://wiki.gnome.org/Projects/Vala/GIONetworkingSample or basically https://wiki.gnome.org/Projects/Vala/Documentation (below "Sample Code") and of course Valadoc https://valadoc.org/gio-2.0/GLib.SocketClient.html https://valadoc.org/gio-2.0/GLib.SocketService.html https://valadoc.org/gio-2.0/GLib.ThreadedSocketService.html https://valadoc.org/gio-2.0/GLib.SocketListener.html https://valadoc.org/gio-2.0/GLib.Socket.html ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Null Coalescing Assignment Operator
> thing = thing ? create (); I think you meant thing = thing ?? create (); Edward seems lazy and don't want to write "thing" two times ;-) ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Roadmap for extending Vala's reach
Am 2017-05-07 um 12:17 schrieb Dr. Michael Lauer: > I was pretty disappointed with the removal of the Posix profile, > since there is quite some potential usage in embedded, kernel-space, and > firmware niches. ME, TOO! ;-) Im actually using Vala for embedded purposes too (actually a Cortex M3@100Mhz CPU) using radare's approach because C++ sucks ;-) So I would really appreciate the return of the Posix profile too! ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Cannot convert from `Gtk.ComboBoxText.get_active_text' to `string'
Note 1: If get_active_text is a PROPERTY instead of a FUNCTION, your code would have been ok. Note 2: Much often, getter/setter functions also have a corresponding property doing the same job. Use whatever you like. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Cannot convert from `Gtk.ComboBoxText.get_active_text' to `string'
Damit, too late ;-) ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Cannot convert from `Gtk.ComboBoxText.get_active_text' to `string'
Hi Sascha, > doctype = cboDocType.get_active_text; You are assigning a function (a delegate, means a pointer to a function) to an string, thats not possible, use doctype = cboDocType.get_active_text(); instead (parantheses on right side) to CALL the get_active_text() function, which returns a string. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] State of the Vala union
>> they have been part of a 200K lines of code project. They must have thought >> it was >> production ready. We are SURE that it was and it IS production ready. We started the project approx. 2-3 years ago (vala 0.22 on Ubuntu 14.04 I think) and it is constantly growing while implementing new features daily. Choosing Vala+GLib+Gtk was a big luck. Curiously, against the mainstream, we choosed it as a replacement for Qt! We implemented a 40k LOC project using Qt before and were NOT satisfied, so we changed to Vala+GLib+Gtk. Fortunately. And we are compiling the app on Windows too using MSYS/mingw. At the beginning, we only compiled the Vala created C sources on Windows (cool feature, isn't it?). Mheanwile, we are compiling directly from the Vala sources using valac on Windows. There ARE some rough edges on Gtk/Windows, but Vala works very good even on Windows. And there are some rough edges on Windows LOL, e.g. UDP really sucks on Windows. But that's another story. > Well, I suppose I have higher requirements than they have. From a > production-ready > compiler I would expect > – no (or at best very obscure) type errors to get through > – no compiler crashes > – no broken code generated > I don't think these are unreasonable criteria, yet valac fails all of them. Until now, we NEVER had only one of these problems. Weird. Honestly, we don't use 100.0% of all language features. Thats because we are creating a real and usable application we can sell to our customers and don't fiddle around with esoteric language features only for the purpose to be the one and only real Vala master ;-) ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Button not visible
> To work with signals i like to use *.clicked.connect. So i tried > box_pack_start (Gtk.Button revision = new Gtk.Button.with_label ("Add > new Revision")); > It looks like this isn't possible. What can i do? Move revision outside from the box_pack_start() to access it from outside, e.g. (not tested): var revision = new Gtk.Button.with_label ("Add new Revision"); revision.clicked.connect(() => { revision.label="You cowardly clicked me!"; }); box.pack_start(revision); P.S.: You know "using Gtk;" on top of your source file? This avoids most of (not all) the "Gtk." stuff. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Vala++
Hi Christian, > Some of us in GNOME have spent many years writing programming languages > and runtimes. Therefore our view is somewhat nuanced and opinionated. As mine is ;-) But I don't understand why the Gnome guys effectively ditch vala (as it appears to me, maybe I'm wrong?). I simply can't find any real reason for this. Gjs is of course a good choice for small Gnome Desktop apps, but why not favor BOTH? Vala and Gjs would be a perfect team I think in different areas. I REALLY don't want (and can't ;-) ) force someone at Gnome to do anything they don't want to do but it's a pity Vala don't receive more support from Gnome. > Congrats! Builder is about 200k of C and it's taken me the past 2 years > to get there. To be honest, a colleague has written 3/4 of it, so my part is only 50.000 LOC (mostly system level code), but total LOC is 200.000. For performance and resource reasons, there was no other option than Vala (maybe except C, but this would have been 500.000 LOC). ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Vala++
Am 2017-04-03 um 02:16 schrieb Nor Jaidi Tuah: > It looks like Vala is going to have > a parallel life: > > https://blogs.gnome.org/chergert/2017/03/31/rustic-gnome-day-3/ > > I hope the gnome+rust people succeed in > recreating the Vala awesomeness in Rust > (even if they don't name it after Vala). I simply can't understand why the Gnome people seems to hate or at least ignore Vala and instead promote Javascript or Rust or other weird stuff. This makes me very unhappy. IMHO Vala is by far the cleanest, easiest and most performant way (both in terms of coding and running) to use GLib/Gtk. I recently wrote a 200k LOC Gtk app and Vala did the job perfectly. No way for Javascript, Python, C++ or even C or Rust. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] How to check if string is empty
Am 2017-01-17 um 12:09 schrieb rastersoft: > That's true for the first one, but the second is as fast as str[0] == 0, > because as soon as one byte doesn't fit, the function ends. You are right, because str=="" indeed calls g_strcmp0(), but str[0]=='\0' calls string_get() which seems not faster that g_strcmp0(). So the fastest (C-like) solution would be: bool is_null_or_empty3 (string? str) { return str == null || *(char*)str == '\0'; } But it's ugly ;-) ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] How to check if string is empty
As Guillaume wrote, you have to use string? str and check string==null FIRST. But I think str.length==0 and str=="" are no high performance solutions, especially for big/long strings. Maybe this is better? bool is_null_or_empty (string? str) { return str == null || str[0] == '\0'; } ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] The future of Vala
Am 2016-09-13 um 02:10 schrieb Michael Gratton: > It really sounds like Vala needs some maintainers. I think there are some Vala USERS out there, which are able and willing to help with some minor and/or simple tasks and don't know how. So the "heavy weights" like Jürg, Luca, Evan and the like can do the important stuff. A list of such "simple and boring stuff" including a general description how to help may push Vala forward only in little steps, but remember: 1000*0.1% = 100% :-) Another idea: What about a "donate" button somewhere? Vala saves much time when programming Gtk/GLib and time==money . -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Array as big as an enum
Hi, and last but not least one may overwrite the to_string method to get own strings like this: enum Test { ONE, TWO; public string to_string() { switch(this) { case ONE: return "enum number one"; case TWO: return "enum number two"; default: return "we, unknown enum number "+((int)this).to_string(); } } } This is for example VERY nice to convert error numbers to error strings. -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Just a news I've read about popularity langage
Am 2016-07-22 um 11:07 schrieb mar...@saepia.net: > I think Vala needs a bit of "marketing" (quotes intentional). Yeah, I agree ultimately! Without quotes! Exaggerated: Vala is used widely, but no one knows about. For example, some month ago, I took a look at the gnome-calculator C source. And what a surprise: it looked very familiar to me, tons of _tmp_ variables: Of course Vala created C source. -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Just a news I've read about popularity langage
Am 2016-07-21 um 21:52 schrieb Adam Tauno Williams: > That is my greatest fear in picking up Vala. My fears are not that big because of the nature of the "binding": VAPI. Im using Vala now for two years for several projects and did not encountered any real LANGUAGE bugs. And creating or fixing VAPI bindings is relatively easy, this is the key point I think. -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Just a news I've read about popularity langage
Am 2016-07-21 um 23:56 schrieb Dev_NIX: > One question: is there a "standard" Vala library/classes? Of course: GLib (and others), simply look at http://www.valadoc.org/#!wiki=index -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
[Vala] xcb.vapi bugs
Hi, don't know where to send vapi bug reports, so I send it to this mailing list, please don't punish me :-) Although xcb.vapi is deprecated and these are minor bugs, it should be corrected I think: Bug #1: xcb_format_t : replace [Simple] by [SimpleType] Bug #2: xcb_visualtype_t: remove [SimpleType] -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] valadoc.org online again, but search not working
Hi Jonathan, many thanks for your hints! -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
[Vala] valadoc.org online again, but search not working
Hi, valadoc.org seems online again, but if one type something into the search field, it shows: 'Query failed: (0)s' Is someone able to fix this? -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] array memory leak?
Anyone who can give a hint why test 1 eats up memory and test 2 do not? I was not able to find a explanation for this behaviour for myself. -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] array memory leak?
Are you sure it's not because optimizations? No I'm not sure :-) I simply don't understand the behaviour differences between test 1 and test 2. But I'm curious to understand what's the reason for this. Try to put Dummy1 method in external compile unit(i.e. different .vala and .c file) and you should get better results. Tried, no changes :-( Maybe I should simply trust Vala/GLib and consider my test code as an artificial provocation of an error that do not exist in practice. -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] array memory leak?
You have to provide more details. What's your method of testing whether memory used by Dummy1 has been freed or not? RSS is at 110 MB here during the loop in either case. I looked at RSS as you did. glibc does not and cannot immediately return every freed block back to the system. Some blocks cannot be freed because they are just gaps between heap-allocated regions and some blocks are intentionally not freed to speed up following allocations. Damn! My background is embedded programming and I'm relatively new to Vala/GLib so I thought g_free is only an other name or a very thin wrapper for free. I really think this is the solution. My appologize for unecessary stealing yours and others time :-( You can normally trust valgrind's output to check whether your application or library has memory leaks. I will do this for now on :-) -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] array memory leak?
'g_free' _is_ (normally) just a wrapper for 'free'. Please note that I'm talking about glibc, not GLib. There is also a memory allocator in GLib, GSlice, which can have its own share of internal fragmentation. However, that's not used for plain strings and arrays. Ok, but the fact that only using a glib message loop removes the leak is a strong clue that glib has something to do with the effect. Anyway, thanks for the clarifications, I will trust vala/glib/glibc and valgrind from now on and I will double or triple check everything before shouting out i've found a memory leak i've found a memory leak ;-) -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] array memory leak?
Am 06.03.2014 01:07, schrieb Nor Jaidi Tuah: Most probably it's the optimizing behaviour of the memory allocator and has got nothing to do with the vala compiler. I don't think this is the case. If you call Dummy2(20), after returning from this function there are approximately 60MB of RAM already used until the program ends. Say LOOPS is 100.000.000 instead of 1.000.000 there are 6GB lost and my PC starts massive swapping. Looks like a memory leak, smells like a memory leak, Of course the memory leak per loop is small and my test functions are a little bit academic (LOOPS is very big), but the leak IS 0 and one is not able to say how big LOOPS is in real life. -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] array memory leak?
Am 05.03.2014 23:01, schrieb Steven Oliver: What version libgee are you using? The one installed with Ubuntu saucy (13.10): 0.8.2 (dpkg says) Anyway, valac which saucy uses is not that old (0.20.1) and my Dummy() functions shows the memory leak with standard vala arrays (no gee involved here I think?) -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] array memory leak?
Hi Juerg, According to valgrind 3.9.0, there are no leaks with this test code on my system (up-to-date Linux on x86-64). I've tested with valac 0.20.1 and valac 0.22.1. Confirmed, valgrind shows no memory leak. I'm puzzled. void Dummy1(int len) { const int LOOPS=100; string[] dummy = new string[LOOPS]; for(var xx=0; xxLOOPS; xx++) dummy[xx]=string.nfill(len, 'x'); } //test 1: memory used by Dummy1 still used after return from Dummy1 int main(string[] args) { Dummy1(100); for(;;); return 0; } //test 2: memory used by Dummy1 FREED after return from Dummy1. WTF? int main(string[] args) { Dummy1(100); MainLoop loop = new MainLoop (); loop.run(); return 0; } WTF? Is there a hidden garbage collector within the main loop or what? Im TOTALLY puzzled now. Seems I have much to learn left, someone illuminate me PLEASE ;-) -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
[Vala] array memory leak?
Consider the following (dummy) functions which shows memory leaks here (valac 0.20.1 on ubuntu saucy 64Bit). It seems the problem exists with Gee.ArrayList too. May someone confirm this? //memory leak if len120 (nfill ist NOT the problem) //NO memory leak if len=120 void Dummy1(int len) { const int LOOPS=100; string[] dummy = new string[LOOPS]; for(var xx=0; xxLOOPS; xx++) dummy[xx]=string.nfill(len, 'x'); } //memory leak if len24 (nfill ist NOT the problem) //NO memory leak if len =24 void Dummy2(int len) { const int LOOPS=100; string[] dummy={}; for(var xx=0; xxLOOPS; xx++) dummy+=string.nfill(len, 'x'); } class CDummy : GLib.Object { private int member; public CDummy(int param) { member=param; } } void Dummy3() //memory leak { const int LOOPS=100; CDummy[] dummy = new CDummy[LOOPS]; for(var xx=0; xxLOOPS; xx++) dummy[xx] = new CDummy(xx); } -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Spreading a class across files
Hackers' Guide to Vala (http://rodney.id.au/dev/vala/hackers.html) says: Classes can be split across files, and this is often done for classes with a lot of methods, or very long methods. Seems I'm too dumb to make it, what is the syntax? -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Private variable/function/class
Hi Evan, In practice this really isn't an issue. Beyond the fact that I don't think non-instance variables are widely used (I certainly don't use many), they should be within your namespace anyways. I agree, but the basic problem is that even private declared variables are put into the .so as public names, this is wrong IMHO. Anyway, Jonas' hack solved the problem for me (thx again). -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Private variable/function/class
Hi Jonas, This is in no way ideal, but I just wanted to tell you that it's possible. Yeah, its a little bit hacky, but it works and so its ok for me ;-) MANY thanks! Maybe one of the vala guys will fix it in a later valac release (I really think this is a bug). -- Bernhard ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Private variable/function/class
Hi, If I'm declaring a private variable/funtion/class and compile it to a package (.so), it is not shown up in the .h and .vapi, this is ok. However, all this symbols ARE exported in the .so symbol table! If one bind more than one .so with e.g. the same PRIVATE variable named testVar it acts like a one single global variable/function, but it should be private! I think valac should compile private variables/functions using the C static modifier? Example .vala file: private int testVar; private void TestFunc(string str) { print(TestFunc+str); } private class TestClass : GLib.Object { private int data; public TestClass() { this.data = 5; } public void Method1() { print(Method1); } } Excerpt from .so symbol Table: 0d3c T TestFunc 309c B testVar 0e38 T testclass_Method1 0dcf T testclass_construct 0f60 T testclass_get_type 0e13 T testclass_new -- Ulink ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list