Is there a portable way to limit memory/cpu usage of a D application?

Dejan Lekic dejan.lekic at gmail.com
Thu Nov 29 02:10:33 PST 2012


On Thursday, 29 November 2012 at 04:44:34 UTC, Mike Young wrote:
> On Wednesday, 9 November 2011 at 17:13:14 UTC, Dejan Lekic 
> wrote:
>> Sure
>> nothing prevents me from using setrlimit() in my D app, but 
>> perhaps it is
>> something to think about a portable way of doing that.
>
> I know I'm over a year late coming in on this conversation, but 
> how would you use setrlimit() in your D app at all?  I can't 
> seem to figure out what the correct library is to include in my 
> program to be able to call set/getrlimit in any manner.  Thanks!

Well, if it is not in the posix module, then you simply use it by 
declaring "extern(C) int setrlimit(int resource, const void* 
rlim);" or something similar if you define the rlimit struct 
somewhere.
Remember, you can call C functions from your D code anytime, 
anywhere.


More information about the Digitalmars-d-learn mailing list