I have a function that will *massively* benefit from having a
persistent internal buffer it can re-use (and grow) from call to
call, instead of re-allocating on every call.
What I don't want is either of:
1. To set a fixed limitation of size, if the user ends up making
repeated calls to someth
On Wednesday, 11 September 2013 at 08:06:37 UTC, monarch_dodra
wrote:
I have a function that will *massively* benefit from having a
persistent internal buffer it can re-use (and grow) from call
to call, instead of re-allocating on every call.
What I don't want is either of:
1. To set a fixed l
On Wednesday, 11 September 2013 at 10:28:37 UTC, Gary Willoughby
wrote:
You can then let the GC handle it or free it yourself with
GC.free(*buffer).
But if the buffer is stored in a static variable, the GC will
never collect it. I *could* also free it myself, but why/when
would I do that?
D
On 11/09/13 12:34, monarch_dodra wrote:
But if the buffer is stored in a static variable, the GC will never collect it.
I *could* also free it myself, but why/when would I do that?
Did you just just let your buffer grow, and never let it get collected?
Is there a way to do something like "I'm u
On 11/09/13 13:14, Joseph Rushton Wakeling wrote:
On 11/09/13 12:34, monarch_dodra wrote:
But if the buffer is stored in a static variable, the GC will never collect it.
I *could* also free it myself, but why/when would I do that?
Did you just just let your buffer grow, and never let it get col
On Wednesday, 11 September 2013 at 08:06:37 UTC, monarch_dodra
wrote:
I have a function that will *massively* benefit from having a
persistent internal buffer it can re-use (and grow) from call
to call, instead of re-allocating on every call.
What I don't want is either of:
1. To set a fixed l
11-Sep-2013 14:34, monarch_dodra пишет:
On Wednesday, 11 September 2013 at 10:28:37 UTC, Gary Willoughby wrote:
You can then let the GC handle it or free it yourself with
GC.free(*buffer).
But if the buffer is stored in a static variable, the GC will never
collect it. I *could* also free it my
On Wednesday, 11 September 2013 at 11:19:27 UTC, Joseph Rushton
Wakeling wrote:
On 11/09/13 13:14, Joseph Rushton Wakeling wrote:
On 11/09/13 12:34, monarch_dodra wrote:
But if the buffer is stored in a static variable, the GC will
never collect it.
I *could* also free it myself, but why/when
On 11/09/13 15:13, monarch_dodra wrote:
That's somewhat better, as it would allow the GC to collect my buffer, if it
wants to, but I wouldn't actually know about it afterwards which leaves me
screwed.
Just to clarify, is this buffer meant only for internal use in your function or
is it meant
11-Sep-2013 17:33, Joseph Rushton Wakeling пишет:
On 11/09/13 15:13, monarch_dodra wrote:
That's somewhat better, as it would allow the GC to collect my buffer,
if it
wants to, but I wouldn't actually know about it afterwards which
leaves me screwed.
Just to clarify, is this buffer meant only
On 11/09/13 15:45, Dmitry Olshansky wrote:
Problem is - said GC-freed memory could be then reused in some way. I can't
imagine how you'd test that the block that is allocated is *still your old*
block.
Ahh, nasty. I'd assumed that the buffer would have been reset to null in the
event that th
On Wednesday, 11 September 2013 at 13:33:23 UTC, Joseph Rushton
Wakeling wrote:
On 11/09/13 15:13, monarch_dodra wrote:
That's somewhat better, as it would allow the GC to collect my
buffer, if it
wants to, but I wouldn't actually know about it afterwards
which leaves me screwed.
Just to clar
On 2013-09-11 10:06, monarch_dodra wrote:
I have a function that will *massively* benefit from having a persistent
internal buffer it can re-use (and grow) from call to call, instead of
re-allocating on every call.
What I don't want is either of:
1. To set a fixed limitation of size, if the user
On Thu, Sep 12, 2013 at 08:27:59AM +0200, Jacob Carlborg wrote:
> On 2013-09-11 10:06, monarch_dodra wrote:
> >I have a function that will *massively* benefit from having a
> >persistent internal buffer it can re-use (and grow) from call to
> >call, instead of re-allocating on every call.
> >
> >Wh
12-Sep-2013 17:51, H. S. Teoh пишет:
On Thu, Sep 12, 2013 at 08:27:59AM +0200, Jacob Carlborg wrote:
On 2013-09-11 10:06, monarch_dodra wrote:
I have a function that will *massively* benefit from having a
persistent internal buffer it can re-use (and grow) from call to
call, instead of re-alloc
12-Sep-2013 20:51, H. S. Teoh пишет:
On Thu, Sep 12, 2013 at 07:50:25PM +0400, Dmitry Olshansky wrote:
12-Sep-2013 17:51, H. S. Teoh пишет:
[...]
struct WeakPointer(T) {
enum size_t mask = 0xdeadbeef;
union Impl {
T* ptr;
On Thursday, 12 September 2013 at 19:13:40 UTC, Dmitry Olshansky
wrote:
Double indirection? Allocate a class that has finalizer, hold
that via weak-ref. The wrapper in turn contains a pointer to
the buffer. The interesting point then is that one may allocate
said buffer via C's realloc.
Then
On Thu, Sep 12, 2013 at 07:50:25PM +0400, Dmitry Olshansky wrote:
> 12-Sep-2013 17:51, H. S. Teoh пишет:
[...]
> > struct WeakPointer(T) {
> > enum size_t mask = 0xdeadbeef;
> > union Impl {
> > T* ptr;
> > size_t uintVal;
> >
On 2013-09-12 15:51, H. S. Teoh wrote:
The problem is, he wants to reuse the buffer next time if the GC hasn't
collected it yet.
I was thinking he could reuse the stack/static buffer. Basically using
two buffers, one static and one dynamic.
--
/Jacob Carlborg
On Thu, Sep 12, 2013 at 11:13:30PM +0400, Dmitry Olshansky wrote:
> 12-Sep-2013 20:51, H. S. Teoh пишет:
> >On Thu, Sep 12, 2013 at 07:50:25PM +0400, Dmitry Olshansky wrote:
[...]
> >>Better option is to have finalizer hooked up to set some flag. Then
> >>_after_ restoring the pointer we consult th
13-Sep-2013 00:11, H. S. Teoh пишет:
On Thu, Sep 12, 2013 at 11:13:30PM +0400, Dmitry Olshansky wrote:
12-Sep-2013 20:51, H. S. Teoh пишет:
On Thu, Sep 12, 2013 at 07:50:25PM +0400, Dmitry Olshansky wrote:
[...]
Better option is to have finalizer hooked up to set some flag. Then
_after_ resto
21 matches
Mail list logo