I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

Gan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 27 11:14:43 PST 2015


On Tuesday, 27 January 2015 at 15:45:47 UTC, bearophile wrote:
> Gan:
>
>> How can I make it use less CPU/RAM?
>
> Most tiny classes probably should be structs. More generally, 
> use a struct every time you don't need a class.
>
> You can start with those two:
>
> struct SBRange {
>     double left = 0.0, right = 0.0, top = 0.0, bottom = 0.0;
> }
>
> struct Point(T) {
>     T x, y;
> }
>
> This probably isn't enough to solve your problems, but it's a 
> start.
>
> Bye,
> bearophile

Is there some special stuff I gotta do extra with structs? Do 
they need manually allocated and released?

On a second question, do I ever need to manually release objects 
I create with new?


More information about the Digitalmars-d-learn mailing list