D - Out of memory?
- Paul Runde <prunde consolidated.net> Jan 23 2004
- J C Calvarese <jcc7 cox.net> Jan 23 2004
- J Anderson <REMOVEanderson badmama.com.au> Jan 23 2004
- Paul Runde <prunde consolidated.net> Jan 23 2004
- yaneurao <yaneurao_member pathlink.com> Jan 23 2004
- Manfred Nowak <svv1999 hotmail.com> Jan 24 2004
- yaneurao <yaneurao_member pathlink.com> Jan 24 2004
- Manfred Nowak <svv1999 hotmail.com> Jan 25 2004
- Paul Runde <prunde consolidated.net> Jan 25 2004
- "Walter" <walter digitalmars.com> Feb 02 2004
I've tried different variations of this:
class foo
{
int x;
int x1;
int x2;
int x3;
}
foo[] fooa;
int main(char[][] args)
{
//fooa.length = 245760;
while(1)
{
try fooa ~= new foo();
catch
{
printf("Allocated %d instances of foo.\n", fooa.length);
break;
}
}
return 0;
}
This one creates 15360 instances of foo whether on a Win95 machine with
128MB or on a WinME with 256MB. I searched the docs and could not find
anything. Also, setting the length of the array to anything over 245760
causes an Access Violation error.
What am I missing?
Thanks.
Jan 23 2004
Paul Runde wrote:I've tried different variations of this: class foo { int x; int x1; int x2; int x3; } foo[] fooa; int main(char[][] args) { //fooa.length = 245760; while(1) { try fooa ~= new foo(); catch { printf("Allocated %d instances of foo.\n", fooa.length); break; } } return 0; } This one creates 15360 instances of foo whether on a Win95 machine with 128MB or on a WinME with 256MB. I searched the docs and could not find anything. Also, setting the length of the array to anything over 245760 causes an Access Violation error. What am I missing? Thanks.
I don't think this is a limitation of D. It may be a limitation of Win9X. It probably also depends on the computer's available memory since each computer has a finite amount of RAM (even when you consider paging files). I have 128MB of RAM and I was running several programs at the same time. (I'm running WinXP Home.) This is what I got: Allocated 1411072 instances of foo. And I also got some friendly message boxes popping up telling me I was low on memory. And icons started disappearing. -- Justin http://jcc_7.tripod.com/d/
Jan 23 2004
J C Calvarese wrote:Paul Runde wrote:I've tried different variations of this: class foo { int x; int x1; int x2; int x3; } foo[] fooa; int main(char[][] args) { //fooa.length = 245760; while(1) { try fooa ~= new foo(); catch { printf("Allocated %d instances of foo.\n", fooa.length); break; } } return 0; } This one creates 15360 instances of foo whether on a Win95 machine with 128MB or on a WinME with 256MB. I searched the docs and could not find anything. Also, setting the length of the array to anything over 245760 causes an Access Violation error. What am I missing? Thanks.
I don't think this is a limitation of D. It may be a limitation of Win9X. It probably also depends on the computer's available memory since each computer has a finite amount of RAM (even when you consider paging files). I have 128MB of RAM and I was running several programs at the same time. (I'm running WinXP Home.) This is what I got: Allocated 1411072 instances of foo. And I also got some friendly message boxes popping up telling me I was low on memory. And icons started disappearing.
get a second hard rive and make a few GB virtual memory on each drive. I think win95 wasn't (isn't) so flexible in this way. Still virtual memory is slowwwww. -- -Anderson: http://badmama.com.au/~anderson/
Jan 23 2004
J Anderson wrote:J C Calvarese wrote:I don't think this is a limitation of D. It may be a limitation of Win9X. It probably also depends on the computer's available memory since each computer has a finite amount of RAM (even when you consider paging files). I have 128MB of RAM and I was running several programs at the same time. (I'm running WinXP Home.) This is what I got: Allocated 1411072 instances of foo. And I also got some friendly message boxes popping up telling me I was low on memory. And icons started disappearing.
get a second hard rive and make a few GB virtual memory on each drive. I think win95 wasn't (isn't) so flexible in this way. Still virtual memory is slowwwww.
Maybe for large collections I should be using class allocators? But it is just odd that two machines with different OS versions and memory amounts would allocate exactly the same number of instances. And I would have expected the results above, but neither machine complained.
Jan 23 2004
In article <busj6v$2dl2$1 digitaldaemon.com>, Paul Runde says...This one creates 15360 instances of foo whether on a Win95 machine with 128MB or on a WinME with 256MB. I searched the docs and could not find anything. Also, setting the length of the array to anything over 245760 causes an Access Violation error.
it is a bug I had reported. D/22303 and I wrote how to fix it. by rebuilding phobos such as the following article, it'll be fixed. D/21217 yaneurao.
Jan 23 2004
yaneurao schrieb: [...]by rebuilding phobos such as the following article, it'll be fixed. D/21217
Cannot rebuild phobos: | std\thread.d(337): undefined identifier GetCurrentProcess Where is the trick? So long. -- Fight Spam! Join EuroCAUCE: http://www.euro.cauce.org/ 2EA56D6D4DC41ABA311615946D3248A1
Jan 24 2004
In article <buv4go$aun$1 digitaldaemon.com>, Manfred Nowak says...Cannot rebuild phobos: | std\thread.d(337): undefined identifier GetCurrentProcess Where is the trick?
it needs forward declaration like this: extern(Windows) export void* GetCurrentProcess(); // void* is an alias of HANDLE yaneurao.
Jan 24 2004
yaneurao wrote:it needs forward declaration like this: extern(Windows) export void* GetCurrentProcess(); // void* is an alias of HANDLE
thnx. extern(Windows) export thread_hdl GetCurrentProcess(); played the trick. So long.
Jan 25 2004









Paul Runde <prunde consolidated.net> 