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

2009-07-04 Thread AxelS
BCS Wrote:

 You can't. The D runtime (and most other runtimes) don't ever reduce the 
 amount of memory they keep in the heap. If you where to allocate another 
 25MB right after that function you would see no change in the memory usage. 
 The good news is that with virtual memory, all of that has almost zero cost. 
 What matters is how much ram you are actively using.
 
 

I want to load and send a file via network...when I load the entire file into 
memory it's very stupid that I can't release that memory again...

OK I'll try it with the C API but thanks for your help!



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

2009-07-04 Thread Daniel Keep

BCS wrote:
 ... The good news is that with virtual memory, all of that has almost
 zero cost. What matters is how much ram you are actively using.

You've obviously never used a netbook with no swap file.  :)


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

2009-07-04 Thread Ary Borenszweig

AxelS escribió:

BCS Wrote:

You can't. The D runtime (and most other runtimes) don't ever reduce the 
amount of memory they keep in the heap. If you where to allocate another 
25MB right after that function you would see no change in the memory usage. 
The good news is that with virtual memory, all of that has almost zero cost. 
What matters is how much ram you are actively using.





I want to load and send a file via network...when I load the entire file into 
memory it's very stupid that I can't release that memory again...


Why not pipe it?


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

2009-07-04 Thread AxelS
@Ary Borenszweig: Good idea but I can't pipe data to a HTTP-server located 
somewhere in the internet...


OK, I tried it with C's malloc and free - but everytime I access my array, D 
puts the memory into its heap...I'm getting crazy because of this!

ubyte[] data=cast(ubyte[])malloc(50_000_000)[0 .. 50_000_000];

foreach(ref d;data)
{
   d=4; // Simulate data access
}

free(data.ptr);

Can't the D compiler handle such problems in future versions?
Of course it's right to release unused memory...but not just release it into 
the program-internal heap...


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

2009-07-04 Thread BCS

Hello Daniel,


BCS wrote:


... The good news is that with virtual memory, all of that has almost
zero cost. What matters is how much ram you are actively using.


You've obviously never used a netbook with no swap file.  :)



Nope, my netbook has a swap file, and I've never heard of one befor (you 
would be better referring to embedded systems). And even if it didn't, unless 
you use that whole array, the system doesn't need to actually map ram for 
what isn't used.


As it happens, I ran across this discussion on swapfiles a few days back.

http://blog.stackoverflow.com/2009/06/podcast-59/
http://serverfault.com/questions/23621/any-benefit-or-detriment-from-removing-a-pagefile-on-an-8gb-ram-machine




Re: Cross-references in ddoc

2009-07-04 Thread Robert Clipsham

Ary Borenszweig wrote:
I've seen both Tango and phobos documentation and it's really hard to 
navigate. Consider this:


class HttpPost {

  void[] write(Pump pump)

}

Pump has no link on it. I can't tell what Pump is. I can see the source 
code (in the web page) invokes super.write(pump), or something like 
that, so I go to HttpClient and there it's not defined.


Tangos docs are generated with dil, which currently has limited semantic 
analysis, so adding a link isn't possible yet. Once dil gets more 
semantic analysis I believe links will be added in.




I open Tango's source code and I find this:

alias void delegate (IBuffer) Pump;

So some questions:

1. (minor problem) Why isn't this appearing in the documentation?


I'd like an answer to this too, it's a pain to have to look at the 
source code to find something simple like this.


2. (major problem) How do you expect users to use your code if they 
can't know what a given method accepts, or what that type is, or how to 
find where a type that's returned by a function is defined?


Don't the docs already give this? (Except where it's defined, which 
isn't possible due to the aforementioned reason)



Documentation is *really* important when programming.

3. Is this a limitation in ddoc?


It's a limitation in dil. dmd does not have the same limitations, 
however I've never needed to generate any docs so can't say much here.



4. Is there a tool to generate documentation with cross-references?


dmd probably can do this, again I've never done it so don't know.

5. Would it help if Descent generated cross-referenced documentation for 
a project?


I'm sure someone would find it useful to be able to click a button to 
generate documentation rather than hit a terminal and enter a command.


Re: Cross-references in ddoc

2009-07-04 Thread Ary Borenszweig

Robert Clipsham escribió:

Ary Borenszweig wrote:
I've seen both Tango and phobos documentation and it's really hard to 
navigate. Consider this:


class HttpPost {

  void[] write(Pump pump)

}

Pump has no link on it. I can't tell what Pump is. I can see the 
source code (in the web page) invokes super.write(pump), or something 
like that, so I go to HttpClient and there it's not defined.


Tangos docs are generated with dil, which currently has limited semantic 
analysis, so adding a link isn't possible yet. Once dil gets more 
semantic analysis I believe links will be added in.




I open Tango's source code and I find this:

alias void delegate (IBuffer) Pump;

So some questions:

1. (minor problem) Why isn't this appearing in the documentation?


I'd like an answer to this too, it's a pain to have to look at the 
source code to find something simple like this.


2. (major problem) How do you expect users to use your code if they 
can't know what a given method accepts, or what that type is, or how 
to find where a type that's returned by a function is defined?


Don't the docs already give this? (Except where it's defined, which 
isn't possible due to the aforementioned reason)


I mean, you can click on the type to see it's documentation. It would 
also be nice if, if the type is an alias, show the alias resolution when 
hovering it.



Documentation is *really* important when programming.

3. Is this a limitation in ddoc?


It's a limitation in dil. dmd does not have the same limitations, 
however I've never needed to generate any docs so can't say much here.



4. Is there a tool to generate documentation with cross-references?


dmd probably can do this, again I've never done it so don't know.


No, it doesn't. I think it doesn't because semantic analysis isn't run 
when generating docs.


5. Would it help if Descent generated cross-referenced documentation 
for a project?


I'm sure someone would find it useful to be able to click a button to 
generate documentation rather than hit a terminal and enter a command.


You are right. :)

I'll try to work on something...

Thanks for your answers, Robert!


Re: Cross-references in ddoc

2009-07-04 Thread Robert Clipsham

Ary Borenszweig wrote:

4. Is there a tool to generate documentation with cross-references?


dmd probably can do this, again I've never done it so don't know.


No, it doesn't. I think it doesn't because semantic analysis isn't run 
when generating docs.


Might be a good idea for a feature request, some semantics would be 
really useful in the docs, as you said.


5. Would it help if Descent generated cross-referenced documentation 
for a project?


I'm sure someone would find it useful to be able to click a button to 
generate documentation rather than hit a terminal and enter a command.


You are right. :)

I'll try to work on something...

Thanks for your answers, Robert!