Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
May 30, 2006 Garbage collector | ||||
---|---|---|---|---|
| ||||
Hi all, DMD 0.159 win32, Why I don't see my memory exploding while the program is running? int main(char[][] argv) { std.gc.disable(); for (int i=0; i < 1000000; i++) { byte[] a = new byte[10000000]; } } Thanks! --- Paolo Invernizzi |
May 30, 2006 Re: Garbage collector | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paolo Invernizzi | Paolo Invernizzi wrote: > Hi all, > > DMD 0.159 win32, Why I don't see my memory exploding while the program is running? > > > int main(char[][] argv) { > std.gc.disable(); > for (int i=0; i < 1000000; i++) { > byte[] a = new byte[10000000]; > } > } > > Thanks! > > --- > Paolo Invernizzi Well, I can only think of a few possibilities: 1. DMD is (for some reason) still collecting the old arrays. 2. DMD is smart enough to omit that line entirely since it knows you're not using it. 3. You have 9 terabytes of RAM. If #3 is correct, I want your machine. The only other thing I can think of is that the program is crashing, but not telling you. Have you verified that the program is getting past that for loop? -- Daniel -- Unlike Knuth, I have neither proven or tried the above; it may not even make sense. v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/ |
May 30, 2006 Re: Garbage collector | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | Daniel Keep wrote: > Paolo Invernizzi wrote: >> Hi all, >> >> DMD 0.159 win32, Why I don't see my memory exploding while the program >> is running? >> >> >> int main(char[][] argv) { >> std.gc.disable(); >> for (int i=0; i < 1000000; i++) { >> byte[] a = new byte[10000000]; >> } >> } >> >> Thanks! >> >> --- >> Paolo Invernizzi > > Well, I can only think of a few possibilities: > > 1. DMD is (for some reason) still collecting the old arrays. > 2. DMD is smart enough to omit that line entirely since it knows you're > not using it. > 3. You have 9 terabytes of RAM. > > If #3 is correct, I want your machine. There's the fourth option => std.gc.disable is not implemented. I was also curious about this, so I checked the source and std.gc.disable/enable only seem to increment/decrement one variable that is never used... -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/ |
May 30, 2006 Re: Garbage collector | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | Daniel Keep escribió:
>>
>> [snip]
> 3. You have 9 terabytes of RAM.
>
> If #3 is correct, I want your machine.
LOL!!! :')
> [snip]
--
Tom;
|
May 31, 2006 Re: Garbage collector | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom S | Tom S wrote: > Daniel Keep wrote: >> Paolo Invernizzi wrote: >>> Hi all, >>> >>> DMD 0.159 win32, Why I don't see my memory exploding while the program is running? >>> >>> >>> int main(char[][] argv) { >>> std.gc.disable(); >>> for (int i=0; i < 1000000; i++) { >>> byte[] a = new byte[10000000]; >>> } >>> } >>> >>> Thanks! >>> >>> --- >>> Paolo Invernizzi >> >> Well, I can only think of a few possibilities: >> >> 1. DMD is (for some reason) still collecting the old arrays. >> 2. DMD is smart enough to omit that line entirely since it knows you're >> not using it. >> 3. You have 9 terabytes of RAM. >> >> If #3 is correct, I want your machine. > > There's the fourth option => std.gc.disable is not implemented. > I was also curious about this, so I checked the source and > std.gc.disable/enable only seem to increment/decrement one variable that > is never used... > > HAHAHAHA. Oh, I wasn't expecting that one... Hopefully that gets fixed at some point :P -- Daniel -- Unlike Knuth, I have neither proven or tried the above; it may not even make sense. v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/ |
Copyright © 1999-2021 by the D Language Foundation