Specify the type but not number of function arguments in an interface?

2009-07-03 Thread Doctor J
I want to write an interface that expresses the following idea: "classes implementing this interface must have a void function named update, with a fixed but indeterminate number of parameters of the same (template parameter) type." In other words, some implementing classes will have void updat

Re: Specify the type but not number of function arguments in an interface?

2009-07-03 Thread Jarrett Billingsley
On Fri, Jul 3, 2009 at 2:54 PM, Doctor J wrote: > I want to write an interface that expresses the following idea: "classes > implementing this interface must have a void function named update, with a > fixed but indeterminate number of parameters of the same (template parameter) > type."  In oth

How to release memory? (D2.0.30)

2009-07-03 Thread AxelS
Hello everyone, I've got a problem with the following (very simple) code: void foo() { void[] dat=new void[50_000_000]; // allocate 50 MByte of dummy-data delete dat; } after I called foo() and watched the memory usage in the windows taskmanager, the program blowed up to 50 MBytes al

Re: How to release memory? (D2.0.30)

2009-07-03 Thread Jarrett Billingsley
On Fri, Jul 3, 2009 at 4:30 PM, AxelS wrote: > Hello everyone, > I've got a problem with the following (very simple) code: > > void foo() > { >      void[] dat=new void[50_000_000]; // allocate 50 MByte of dummy-data >      delete dat; > } > > after I called foo() and watched the memory usage in th

Re: How to release memory? (D2.0.30)

2009-07-03 Thread BCS
Reply to AxelS, Hello everyone, I've got a problem with the following (very simple) code: void foo() { void[] dat=new void[50_000_000]; // allocate 50 MByte of dummy-data delete dat; } after I called foo() and watched the memory usage in the windows taskmanager, the program blowed up to 50 MByte

Compiler doesn't see the inherited opApply in this example

2009-07-03 Thread Mike L.
Hello, can anybody explain why the following code compiles with -version=works but not without? module test; import std.stdio; abstract class Parent { int opApply(int delegate(ref int) dg) { int fakeDelegate(ref uint fake, ref int content)

Re: Compiler doesn't see the inherited opApply in this example

2009-07-03 Thread Mike L.
Apparently I'm missing some basic concept about how D does OO since I recreated the problem with a simpler function. I'll re-examine things...

Re: How to release memory? (D2.0.30)

2009-07-03 Thread bearophile
AxelS: > void[] dat=new void[50_000_000]; // allocate 50 MByte of dummy-data I am not sure, but the GC may scan that chunk of voids. If you need a raw block it may be better to work with an array of uint. > Why can't the GC remove that data and how CAN I remove it? If you really need to