non-determinant object lifetime and memory management

2013-11-30 Thread Frustrated
I need to pass around some objects(specifically int[]) that may be used by several other objects at the same time. While I could clone these and free them when the parent object is done this wastes memory for no real reason except ease of use. Since many objects may contain a ptr to the array,

Re: toStringz, and memory management, also fromStringz

2011-09-09 Thread Joel Christensen
On 10-Sep-11 3:09 PM, Jonathan M Davis wrote: Jonathan M Davis Ok, now I have a better idea with char pointers. And the std.conv.to worked too. Thanks. - Joelcnz

Re: toStringz, and memory management, also fromStringz

2011-09-09 Thread Jonathan M Davis
On Saturday, September 10, 2011 13:00:02 Joel Christensen wrote: > Hi, > > In the std.string document at toStringz it has this note: > > Important Note: When passing a char* to a C function, and the C function > keeps it around for any reason, make sure that you keep a reference to > it in your D

toStringz, and memory management, also fromStringz

2011-09-09 Thread Joel Christensen
Hi, In the std.string document at toStringz it has this note: Important Note: When passing a char* to a C function, and the C function keeps it around for any reason, make sure that you keep a reference to it in your D code. Otherwise, it may go away during a garbage collection cycle and caus

Re: Memory management and garbage collectors

2010-08-30 Thread JMRyan
Thank you for your reply. It was helpful.

Re: Memory management and garbage collectors

2010-08-28 Thread bearophile
JMRyan: > In theory, garbage collectors make memory leaks a thing of the past. Even with a perfect GC you may leave around references that keep alive some data that you will never need to use. This is a kind of memory leak. And the current D GC is not fully precise, this means that sometimes it

Memory management and garbage collectors

2010-08-28 Thread JMRyan
In theory, garbage collectors make memory leaks a thing of the past. In practice, garbage collectors don't always work according to theory. This makes me curious: how does one test for memory leaks in a D program? I also don't know how smart or dumb garbage collectors are. How much help doe

Memory management documentation

2010-06-01 Thread Ali Çehreli
Some of the examples at http://digitalmars.com/d/2.0/memory.html seem to be outdated: - dmd 2.046 does not have std.outofmemory. Where is OutOfMemoryException defined? - no std.gc: (I found out later that core.memory is it) Where can I learn more about the current features on memory

<    1   2