Re: "Memory allocation failed" on big array

2022-07-20 Thread urned utt via Digitalmars-d-learn
Big thank. Switch to /bin64 and now works until full memory using.

Re: "Memory allocation failed" on big array

2022-07-20 Thread ryuukk_ via Digitalmars-d-learn
My guess is you are compiling to 32bit and the GC tries to reserve >4gb wich it can't, therefore out of memory Compiling to 64bit with: `dmd -m64 -run test.d` works no problem

Re: Memory allocation

2021-02-23 Thread David via Digitalmars-d-learn
On Wednesday, 24 February 2021 at 06:14:58 UTC, Imperatorn wrote: On Tuesday, 23 February 2021 at 19:44:39 UTC, David wrote: Not sure if `learn` is the right topic or not to post this.. I've been going through Bob Nystrom's "Crafting Interpreters" for a bit of fun and over the weekend put toge

Re: Memory allocation

2021-02-23 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 23 February 2021 at 19:44:39 UTC, David wrote: Not sure if `learn` is the right topic or not to post this.. I've been going through Bob Nystrom's "Crafting Interpreters" for a bit of fun and over the weekend put together a toy allocator in D - free and gc not yet done. It's single

Re: Memory allocation failed in CT

2019-07-13 Thread a11e99z via Digitalmars-d-learn
On Saturday, 13 July 2019 at 06:25:37 UTC, Andrey wrote: On Tuesday, 9 July 2019 at 19:04:53 UTC, Max Haughton wrote: Is this a 64 or 32 bit compiler? Also could you post the source code if possible? You could try "--DRT-gcopt=profile:1" druntime flag to see if the compiler is running out of

Re: Memory allocation failed in CT

2019-07-12 Thread Andrey via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 19:04:53 UTC, Max Haughton wrote: Is this a 64 or 32 bit compiler? Also could you post the source code if possible? You could try "--DRT-gcopt=profile:1" druntime flag to see if the compiler is running out of memory for real Thanks for help. I solved my issue by re

Re: Memory allocation failed in CT

2019-07-09 Thread Max Haughton via Digitalmars-d-learn
Is this a 64 or 32 bit compiler? Also could you post the source code if possible? You could try "--DRT-gcopt=profile:1" druntime flag to see if the compiler is running out of memory for real

Re: Memory allocation failed in CT

2019-07-09 Thread Andrey via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 17:59:24 UTC, Max Haughton wrote: On Tuesday, 9 July 2019 at 17:48:52 UTC, Andrey wrote: Hello, I have got a problem with compile-time calulations. I have some code generator that should create some long string of code during CT and after generation I mixin it. If I r

Re: Memory allocation failed in CT

2019-07-09 Thread Andrey via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 17:59:24 UTC, Max Haughton wrote: On Tuesday, 9 July 2019 at 17:48:52 UTC, Andrey wrote: I in addition wrote "buffer.reserve(10 * 1014 * 1024);" and it also doesn't help.

Re: Memory allocation failed in CT

2019-07-09 Thread Max Haughton via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 17:48:52 UTC, Andrey wrote: Hello, I have got a problem with compile-time calulations. I have some code generator that should create some long string of code during CT and after generation I mixin it. If I run it normally - in run time - then there is no error and I g

Re: Memory Allocation

2017-03-30 Thread Enigma via Digitalmars-d-learn
On Thursday, 30 March 2017 at 11:22:05 UTC, Gary Willoughby wrote: On Wednesday, 29 March 2017 at 19:19:48 UTC, Enigma wrote: I have a memory buffer allocated using different methods. It is simply a pointer and a size. I would like to be able to manage this buffer by treating it as a memory p

Re: Memory Allocation

2017-03-30 Thread Enigma via Digitalmars-d-learn
On Wednesday, 29 March 2017 at 23:26:04 UTC, H. S. Teoh wrote: On Wed, Mar 29, 2017 at 11:01:12PM +, Enigma via Digitalmars-d-learn wrote: On Wednesday, 29 March 2017 at 21:36:14 UTC, Petar Kirov [ZombineDev] wrote: > [...] But these seem to require passing a mallocator. I simply want to

Re: Memory Allocation

2017-03-30 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 29 March 2017 at 19:19:48 UTC, Enigma wrote: I have a memory buffer allocated using different methods. It is simply a pointer and a size. I would like to be able to manage this buffer by treating it as a memory pool or heap. I think I can use allocators to do this but not sure h

Re: Memory Allocation

2017-03-29 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Mar 29, 2017 at 11:01:12PM +, Enigma via Digitalmars-d-learn wrote: > On Wednesday, 29 March 2017 at 21:36:14 UTC, Petar Kirov [ZombineDev] wrote: > > On Wednesday, 29 March 2017 at 19:19:48 UTC, Enigma wrote: > > > [...] > > > > It looks like you are looking for this: > > http://dlang

Re: Memory Allocation

2017-03-29 Thread Enigma via Digitalmars-d-learn
On Wednesday, 29 March 2017 at 21:36:14 UTC, Petar Kirov [ZombineDev] wrote: On Wednesday, 29 March 2017 at 19:19:48 UTC, Enigma wrote: [...] It looks like you are looking for this: http://dlang.org/phobos-prerelease/std_experimental_allocator_building_blocks_region.html. But these seem to

Re: Memory Allocation

2017-03-29 Thread via Digitalmars-d-learn
On Wednesday, 29 March 2017 at 19:19:48 UTC, Enigma wrote: I have a memory buffer allocated using different methods. It is simply a pointer and a size. I would like to be able to manage this buffer by treating it as a memory pool or heap. I think I can use allocators to do this but not sure h

Re: Memory Allocation

2017-03-29 Thread Faux Amis via Digitalmars-d-learn
On 2017-03-29 23:30, Faux Amis wrote: On 2017-03-29 21:19, Enigma wrote: I have a memory buffer allocated using different methods. It is simply a pointer and a size. Can you maybe just tread it like an array and slice it for allocation? *treat*

Re: Memory Allocation

2017-03-29 Thread Faux Amis via Digitalmars-d-learn
On 2017-03-29 21:19, Enigma wrote: I have a memory buffer allocated using different methods. It is simply a pointer and a size. Can you maybe just tread it like an array and slice it for allocation?

Re: Memory allocation failed. Why?

2016-11-23 Thread MGW via Digitalmars-d-learn
On Tuesday, 22 November 2016 at 15:53:39 UTC, Steven Schveighoffer wrote: On 11/21/16 11:53 AM, ag0aep6g wrote: Thank you very much for explaining such a difficult and slippery situation.

Re: Memory allocation failed. Why?

2016-11-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/21/16 11:53 AM, ag0aep6g wrote: On Monday, 21 November 2016 at 16:37:32 UTC, Kagamin wrote: Anything in .data and .bss sections and stack. See https://issues.dlang.org/show_bug.cgi?id=15723 Ok, not an actual reference then, but a false pointer. Yes. 100 million bytes is 1/40 of all add

Re: Memory allocation failed. Why?

2016-11-21 Thread thedeemon via Digitalmars-d-learn
On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: core.exception.OutOfMemoryError@src\core\exception.d(693): Memory allocation failed Simple program and error. Why? Windows 7 (32) dmd 2.072.0 Making a 100 million bytes array by appending one byte at

Re: Memory allocation failed. Why?

2016-11-21 Thread ag0aep6g via Digitalmars-d-learn
On Monday, 21 November 2016 at 16:37:32 UTC, Kagamin wrote: Anything in .data and .bss sections and stack. See https://issues.dlang.org/show_bug.cgi?id=15723 Ok, not an actual reference then, but a false pointer.

Re: Memory allocation failed. Why?

2016-11-21 Thread Kagamin via Digitalmars-d-learn
On Monday, 21 November 2016 at 11:22:40 UTC, ag0aep6g wrote: Who could "someone" be? It's a self-contained example, and buf doesn't leave the test function. Anything in .data and .bss sections and stack. See https://issues.dlang.org/show_bug.cgi?id=15723 As for GC compaction: https://issues

Re: Memory allocation failed. Why?

2016-11-21 Thread ag0aep6g via Digitalmars-d-learn
On 11/21/2016 08:27 AM, Stefan Koch wrote: Someone could still be hanging on to an old Reference of buf. Who could "someone" be? It's a self-contained example, and buf doesn't leave the test function.

Re: Memory allocation failed. Why?

2016-11-20 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 21 November 2016 at 06:45:04 UTC, ag0aep6g wrote: On 11/21/2016 07:36 AM, Stefan Koch wrote: On Monday, 21 November 2016 at 03:58:00 UTC, MGW wrote: On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: [...] [...] Y

Re: Memory allocation failed. Why?

2016-11-20 Thread ag0aep6g via Digitalmars-d-learn
On 11/21/2016 07:36 AM, Stefan Koch wrote: On Monday, 21 November 2016 at 03:58:00 UTC, MGW wrote: On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: import core.sys.windows.windows: MessageBoxA; void test() { for(int i; i

Re: Memory allocation failed. Why?

2016-11-20 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 21 November 2016 at 03:58:00 UTC, MGW wrote: On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: import core.sys.windows.windows: MessageBoxA; void test() { for(int i; i != 10; i++) { ubyte[] b

Re: Memory allocation failed. Why?

2016-11-20 Thread MGW via Digitalmars-d-learn
On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: import core.sys.windows.windows: MessageBoxA; void test() { for(int i; i != 10; i++) { ubyte[] buf; for(int j; j != 1; j++) buf ~

Re: Memory allocation failed. Why?

2016-11-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: [...] For me there's no exception. Maybe the GC is poluted. Try to add this after each iteration in the first test loop: import core.memory: GC; GC.collect()

Re: Memory allocation failed. Why?

2016-11-20 Thread Basile B. via Digitalmars-d-learn
On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: import core.sys.windows.windows: MessageBoxA; void test() { for(int i; i != 10; i++) { ubyte[] buf; for(int j; j != 1; j++) buf ~= 65; MessageBoxA(null, "--on for--".ptr, "".pt

Re: Memory allocation faile on string concat

2010-12-23 Thread Steven Schveighoffer
On Thu, 11 Nov 2010 07:42:36 -0500, Steven Schveighoffer wrote: On Wed, 10 Nov 2010 23:33:58 -0500, Xie wrote: OK, this actually makes sense to me. It's a manifestation of this issue: http://d.puremagic.com/issues/show_bug.cgi?id=3929 I'm think - it's truth but not at all. Sorry, but

Re: Memory allocation faile on string concat

2010-11-11 Thread Steven Schveighoffer
On Wed, 10 Nov 2010 23:33:58 -0500, Xie wrote: OK, this actually makes sense to me. It's a manifestation of this issue: http://d.puremagic.com/issues/show_bug.cgi?id=3929 I'm think - it's truth but not at all. Sorry, but i'm give incomplete data. My example run fine, when benchmark(1), (

Re: Memory allocation faile on string concat

2010-11-10 Thread Xie
>OK, this actually makes sense to me. >It's a manifestation of this issue: >http://d.puremagic.com/issues/show_bug.cgi?id=3929 I'm think - it's truth but not at all. Sorry, but i'm give incomplete data. My example run fine, when benchmark(1), (2), but not 10. This means, that memory not collect

Re: Memory allocation faile on string concat

2010-11-10 Thread Steven Schveighoffer
On Wed, 10 Nov 2010 14:38:02 -0500, Xie wrote: Sorry, it a mistypo (i began from wchar[], later changed to wstring) Real problem can be seen here import std.stdio; import std.date; void f0() { wstring a; foreach(i; 0 .. 100_000_000) { a ~= " "w;

Re: Memory allocation faile on string concat

2010-11-10 Thread Xie
Sorry, it a mistypo (i began from wchar[], later changed to wstring) Real problem can be seen here import std.stdio; import std.date; void f0() { wstring a; foreach(i; 0 .. 100_000_000) { a ~= " "w; } } void main() { auto r = benchmark!(f

Re: Memory allocation faile on string concat

2010-11-10 Thread Steven Schveighoffer
On Wed, 10 Nov 2010 14:06:40 -0500, Steven Schveighoffer wrote: Just tried it, Appender is actually slower. This *is* a problem, it should be way faster than builtin array appending. I will look into it. More data, Appender taking an array of elements is significantly slower than taki

Re: Memory allocation faile on string concat

2010-11-10 Thread Steven Schveighoffer
On Wed, 10 Nov 2010 13:55:26 -0500, sybrandy wrote: On 11/10/2010 11:33 AM, Xie wrote: Can't run a simple program. What's wrong, GC? import std.stdio; import std.date; void f0() { wstring a[]; foreach(i; 0 .. 100_000_000) { a ~= " "w; } } voi

Re: Memory allocation faile on string concat

2010-11-10 Thread sybrandy
On 11/10/2010 11:33 AM, Xie wrote: Can't run a simple program. What's wrong, GC? import std.stdio; import std.date; void f0() { wstring a[]; foreach(i; 0 .. 100_000_000) { a ~= " "w; } } void main() { auto r = benchmark!(f0)(1);

Re: Memory allocation faile on string concat

2010-11-10 Thread Steven Schveighoffer
On Wed, 10 Nov 2010 13:33:11 -0500, Steven Schveighoffer wrote: On Wed, 10 Nov 2010 11:33:45 -0500, Xie wrote: Can't run a simple program. What's wrong, GC? import std.stdio; import std.date; void f0() { wstring a[]; foreach(i; 0 .. 100_000_000) {

Re: Memory allocation faile on string concat

2010-11-10 Thread Steven Schveighoffer
On Wed, 10 Nov 2010 11:33:45 -0500, Xie wrote: Can't run a simple program. What's wrong, GC? import std.stdio; import std.date; void f0() { wstring a[]; foreach(i; 0 .. 100_000_000) { a ~= " "w; } } void main() { auto r = benchmark!(f0

Re: Memory allocation faile on string concat

2010-11-10 Thread Jonathan M Davis
On Wednesday, November 10, 2010 08:33:45 Xie wrote: > Can't run a simple program. What's wrong, GC? > > import std.stdio; > import std.date; > > void f0() > { > wstring a[]; > > foreach(i; 0 .. 100_000_000) > { > a ~= " "w; > } > } > > void main() > { >