Re: High memory usage in vibe.d application

2018-06-29 Thread rikki cattermole via Digitalmars-d-learn
On 30/06/2018 4:49 AM, Bauss wrote: I wouldn't really blame the GC. There is a higher chance you're just not using it how it's meant to be, especially since it looks like you're mixing manual memory management with GC memory. Let's be honest, I don't think it was meant to live in a container

Re: Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Ali Çehreli via Digitalmars-d-learn
On 06/29/2018 02:11 PM, Timoses wrote: > How would one print the address of the object then though? > Since is the address of the reference' types stack location. Casting the reference to void* produces the address of the object: import std.stdio; class C { int i; } void main() {

Re: Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Ali Çehreli via Digitalmars-d-learn
On 06/29/2018 02:40 PM, Robert M. Münch wrote: > How does it work if one of the members takes an argument that is deduced > inside the handler function? > > > On 2018-06-29 18:05:00 +, Ali ‡ehreli said: > >> Passing a lambda or a string mixin: >> >> import std.stdio; >> >> class C { >>

Re: Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 June 2018 at 16:44:36 UTC, Robert M. Münch wrote: I hope this is understandable... I have: class C { void A(); void B(); void C(); } I'm iterating over a set of objects of class C like: foreach(obj; my_selected_objs){ ... } The iteration and code

Re: Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Robert M. Münch via Digitalmars-d-learn
How does it work if one of the members takes an argument that is deduced inside the handler function? On 2018-06-29 18:05:00 +, Ali ‡ehreli said: Passing a lambda or a string mixin: import std.stdio; class C { void A() { writeln(__FUNCTION__); } void B() {

Re: Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Timoses via Digitalmars-d-learn
On Friday, 29 June 2018 at 20:28:55 UTC, Timoses wrote: On Friday, 29 June 2018 at 16:44:36 UTC, Robert M. Münch wrote: Trying to fiddle around a bit with delegates.. But why is the context for delegates not working for classes?? Aw.. Class = reference type so class A { } struct B { } void

Re: Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Timoses via Digitalmars-d-learn
On Friday, 29 June 2018 at 16:44:36 UTC, Robert M. Münch wrote: I hope this is understandable... I have: class C { void A(); void B(); void C(); } I'm iterating over a set of objects of class C like: foreach(obj; my_selected_objs){ ... } The iteration and code

Re: Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Timoses via Digitalmars-d-learn
On Friday, 29 June 2018 at 20:08:56 UTC, Robert M. Münch wrote: On 2018-06-29 18:05:00 +, Ali ‡ehreli said: On 06/29/2018 09:44 AM, Robert M. Münch wrote: void handler(alias func)(C[] cs) { foreach (c; cs) { func(c); } } Is it possible to make C[] a template type so

Re: Issues with undefined symbols when using Vibe on Windows

2018-06-29 Thread Chris M. via Digitalmars-d-learn
On Friday, 29 June 2018 at 19:53:04 UTC, Timoses wrote: On Friday, 29 June 2018 at 19:25:42 UTC, Chris M. wrote: This doesn't appear to specifically be a Vibe issue, just noticing this error when I use eventcore from it (trying to use async). C:\dmd2\windows\bin\lld-link.exe: warning:

Re: Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-06-29 18:05:00 +, Ali ‡ehreli said: On 06/29/2018 09:44 AM, Robert M. Münch wrote: So, how can I write a generic handler that does the iteration, where I can specify which member function to call? Passing a lambda or a string mixin: Hi, that was somehow in my mind but didn't

Re: Issues with undefined symbols when using Vibe on Windows

2018-06-29 Thread Chris M. via Digitalmars-d-learn
On Friday, 29 June 2018 at 19:53:27 UTC, bauss wrote: On Friday, 29 June 2018 at 19:25:42 UTC, Chris M. wrote: [...] Are you compiling to 64bit? Else the functions will be named GetClassLongA and SetClassLongA Yeah, that's what I'm targeting Vibe builds fine on 64bit for me and I think

Re: Issues with undefined symbols when using Vibe on Windows

2018-06-29 Thread bauss via Digitalmars-d-learn
On Friday, 29 June 2018 at 19:53:04 UTC, Timoses wrote: On Friday, 29 June 2018 at 19:25:42 UTC, Chris M. wrote: This doesn't appear to specifically be a Vibe issue, just noticing this error when I use eventcore from it (trying to use async). C:\dmd2\windows\bin\lld-link.exe: warning:

Re: Issues with undefined symbols when using Vibe on Windows

2018-06-29 Thread Timoses via Digitalmars-d-learn
On Friday, 29 June 2018 at 19:25:42 UTC, Chris M. wrote: This doesn't appear to specifically be a Vibe issue, just noticing this error when I use eventcore from it (trying to use async). C:\dmd2\windows\bin\lld-link.exe: warning: eventcore.lib(sockets_101f_952.obj): undefined symbol:

Re: Issues with undefined symbols when using Vibe on Windows

2018-06-29 Thread bauss via Digitalmars-d-learn
On Friday, 29 June 2018 at 19:25:42 UTC, Chris M. wrote: This doesn't appear to specifically be a Vibe issue, just noticing this error when I use eventcore from it (trying to use async). C:\dmd2\windows\bin\lld-link.exe: warning: eventcore.lib(sockets_101f_952.obj): undefined symbol:

Issues with undefined symbols when using Vibe on Windows

2018-06-29 Thread Chris M. via Digitalmars-d-learn
This doesn't appear to specifically be a Vibe issue, just noticing this error when I use eventcore from it (trying to use async). C:\dmd2\windows\bin\lld-link.exe: warning: eventcore.lib(sockets_101f_952.obj): undefined symbol: SetWindowLongPtrA C:\dmd2\windows\bin\lld-link.exe: warning:

Re: Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Ali Çehreli via Digitalmars-d-learn
On 06/29/2018 09:44 AM, Robert M. Münch wrote: So, how can I write a generic handler that does the iteration, where I can specify which member function to call? Passing a lambda or a string mixin: import std.stdio; class C { void A() { writeln(__FUNCTION__); } void B()

Re: High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
On Friday, 29 June 2018 at 16:49:41 UTC, Bauss wrote: On Friday, 29 June 2018 at 16:07:00 UTC, Anton Fediushin wrote: On Friday, 29 June 2018 at 11:11:57 UTC, rikki cattermole wrote: On 29/06/2018 11:09 PM, Anton Fediushin wrote: It is GC's fault for sure, I built my program with profile-gc

Re: Why tuples are not ranges?

2018-06-29 Thread Ali Çehreli via Digitalmars-d-learn
On 06/28/2018 11:10 PM, Jonathan M Davis wrote: > On Friday, June 29, 2018 05:52:03 Alex via Digitalmars-d-learn wrote: >> Wouldn't this be weird from the semantic view? I agree with all your concerns. The fact that Meta decided to make the element type Algebraic!T as opposed to my

Re: High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
On Friday, 29 June 2018 at 16:19:39 UTC, 12345swordy wrote: On Friday, 29 June 2018 at 16:07:00 UTC, Anton Fediushin wrote: Now I finally understand why GC is not a great thing. I was writing apps utilizing GC for a long time and never had problems with it, but when it came down to this simple

Re: High memory usage in vibe.d application

2018-06-29 Thread Bauss via Digitalmars-d-learn
On Friday, 29 June 2018 at 16:07:00 UTC, Anton Fediushin wrote: On Friday, 29 June 2018 at 11:11:57 UTC, rikki cattermole wrote: On 29/06/2018 11:09 PM, Anton Fediushin wrote: It is GC's fault for sure, I built my program with profile-gc and it allocated a lot there. Question is, why doesn't

Call different member functions on object sequence with a generic handler function?

2018-06-29 Thread Robert M. Münch via Digitalmars-d-learn
I hope this is understandable... I have: class C { void A(); void B(); void C(); } I'm iterating over a set of objects of class C like: foreach(obj; my_selected_objs){ ... } The iteration and code before/afterwards always looks the same, I need this iteration

Re: High memory usage in vibe.d application

2018-06-29 Thread 12345swordy via Digitalmars-d-learn
On Friday, 29 June 2018 at 16:07:00 UTC, Anton Fediushin wrote: On Friday, 29 June 2018 at 11:11:57 UTC, rikki cattermole wrote: On 29/06/2018 11:09 PM, Anton Fediushin wrote: It is GC's fault for sure, I built my program with profile-gc and it allocated a lot there. Question is, why doesn't

Re: High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
On Friday, 29 June 2018 at 11:11:57 UTC, rikki cattermole wrote: On 29/06/2018 11:09 PM, Anton Fediushin wrote: It is GC's fault for sure, I built my program with profile-gc and it allocated a lot there. Question is, why doesn't it free this memory? Probably doesn't know that it should

Re: High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
On Friday, 29 June 2018 at 14:10:26 UTC, Daniel Kozak wrote: Have you try use VibeManualMemoryManagement https://github.com/TechEmpower/FrameworkBenchmarks/blob/3b24d0a21463edc536b30e2cea647fd425915401/frameworks/D/vibed/dub.json#L22 I'll try, not quite sure it'll help much.

Re: High memory usage in vibe.d application

2018-06-29 Thread Daniel Kozak via Digitalmars-d-learn
Have you try use VibeManualMemoryManagement https://github.com/TechEmpower/FrameworkBenchmarks/blob/3b24d0a21463edc536b30e2cea647fd425915401/frameworks/D/vibed/dub.json#L22 On Fri, Jun 29, 2018 at 3:20 PM Anton Fediushin via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On

Re: High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
On Friday, 29 June 2018 at 11:42:18 UTC, bauss wrote: On Friday, 29 June 2018 at 11:24:14 UTC, Anton Fediushin wrote: On Friday, 29 June 2018 at 11:01:41 UTC, Anton Fediushin wrote: On Friday, 29 June 2018 at 10:21:24 UTC, Radu wrote: On Friday, 29 June 2018 at 09:44:27 UTC, Anton Fediushin

Re: High memory usage in vibe.d application

2018-06-29 Thread bauss via Digitalmars-d-learn
On Friday, 29 June 2018 at 11:24:14 UTC, Anton Fediushin wrote: On Friday, 29 June 2018 at 11:01:41 UTC, Anton Fediushin wrote: On Friday, 29 June 2018 at 10:21:24 UTC, Radu wrote: On Friday, 29 June 2018 at 09:44:27 UTC, Anton Fediushin wrote: Almost forgot, there are two timers which call

Re: High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
On Friday, 29 June 2018 at 11:01:41 UTC, Anton Fediushin wrote: On Friday, 29 June 2018 at 10:21:24 UTC, Radu wrote: On Friday, 29 June 2018 at 09:44:27 UTC, Anton Fediushin wrote: Almost forgot, there are two timers which call this function for two different streams. Value of `metaint` is

Re: High memory usage in vibe.d application

2018-06-29 Thread rikki cattermole via Digitalmars-d-learn
On 29/06/2018 11:09 PM, Anton Fediushin wrote: It is GC's fault for sure, I built my program with profile-gc and it allocated a lot there. Question is, why doesn't it free this memory? Probably doesn't know that it should deallocate so eagerly. A GC.collect(); call may help.

Re: High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
On Friday, 29 June 2018 at 10:31:14 UTC, bauss wrote: On Friday, 29 June 2018 at 10:21:24 UTC, Radu wrote: On Friday, 29 June 2018 at 09:44:27 UTC, Anton Fediushin wrote: Almost forgot, there are two timers which call this function for two different streams. Value of `metaint` is 16000,

Re: High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
On Friday, 29 June 2018 at 10:21:24 UTC, Radu wrote: On Friday, 29 June 2018 at 09:44:27 UTC, Anton Fediushin wrote: Almost forgot, there are two timers which call this function for two different streams. Value of `metaint` is 16000, which means that only 16KB of memory are allocated for the

Re: High memory usage in vibe.d application

2018-06-29 Thread bauss via Digitalmars-d-learn
On Friday, 29 June 2018 at 10:21:24 UTC, Radu wrote: On Friday, 29 June 2018 at 09:44:27 UTC, Anton Fediushin wrote: Almost forgot, there are two timers which call this function for two different streams. Value of `metaint` is 16000, which means that only 16KB of memory are allocated for the

Re: High memory usage in vibe.d application

2018-06-29 Thread Radu via Digitalmars-d-learn
On Friday, 29 June 2018 at 09:44:27 UTC, Anton Fediushin wrote: Almost forgot, there are two timers which call this function for two different streams. Value of `metaint` is 16000, which means that only 16KB of memory are allocated for the `buffer`, then it reads another byte which contains

Re: errnoEnforce: which imports?

2018-06-29 Thread kdevel via Digitalmars-d-learn
On Friday, 29 June 2018 at 09:22:03 UTC, Jonathan M Davis wrote: Shall I create a bug report? Yes. Aside from someone trying it out and complaining about it, it probably wouldn't be noticed or fixed, since it's one of the few tests that doesn't work as a ddoc-ed unit test. Issue 19041 -

Re: High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
Almost forgot, there are two timers which call this function for two different streams. Value of `metaint` is 16000, which means that only 16KB of memory are allocated for the `buffer`, then it reads another byte which contains length of the metadata / 16 and then it reads the metadata which

High memory usage in vibe.d application

2018-06-29 Thread Anton Fediushin via Digitalmars-d-learn
Hello, I'm looking for an advice on what I am doing wrong. I have a vibe.d-based program, which connects to an audio stream and gets name of the song currently playing. For that, I wrote the following code: ``` @safe string nowPlaying(string url) { import vibe.core.stream;

Re: errnoEnforce: which imports?

2018-06-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 29, 2018 09:08:40 kdevel via Digitalmars-d-learn wrote: > On Friday, 29 June 2018 at 02:28:04 UTC, Jonathan M Davis wrote: > > [...] really, that example needs to be completely redone. > > Shall I create a bug report? Yes. Aside from someone trying it out and complaining about it,

Re: errnoEnforce: which imports?

2018-06-29 Thread kdevel via Digitalmars-d-learn
On Friday, 29 June 2018 at 02:28:04 UTC, Jonathan M Davis wrote: [...] really, that example needs to be completely redone. Shall I create a bug report?

Re: E-mail attachment with scrambled text.

2018-06-29 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 28 June 2018 at 14:42:36 UTC, vino.B wrote: Thank you very much, after replacing all the '\n' with '\r\n' it resolved 99% of the formatting issue expect for the below function, can you help me on the same. auto getAvailableDiskSpace(Array!string UtilDrive, File logF) { auto

Re: Create D binding for C struct containing templated class

2018-06-29 Thread evilrat via Digitalmars-d-learn
On Friday, 29 June 2018 at 06:04:10 UTC, Andre Pany wrote: Thanks a lot for the great help. You are right, until now I haven't looked at the include folder, I thought the "surface" folder is the folder with the public api. But it seems also in the include folder, the header files contains

Re: Why tuples are not ranges?

2018-06-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 29, 2018 05:52:03 Alex via Digitalmars-d-learn wrote: > On Thursday, 28 June 2018 at 19:02:51 UTC, Ali Çehreli wrote: > > On 06/28/2018 11:08 AM, Mr.Bingo wrote: > > > Thanks, why not add the ability to pass through ranges and > > > > arrays and > > > > > add it to phobos? > > > >

Re: Create D binding for C struct containing templated class

2018-06-29 Thread Andre Pany via Digitalmars-d-learn
On Friday, 29 June 2018 at 01:38:23 UTC, evilrat wrote: On Thursday, 28 June 2018 at 18:43:11 UTC, Andre Pany wrote: [...] No, unfortunately D cannot interface with C templates, only C++ templates. But just by coincidence this is C++ source code (and so the templates). So it is possible