in reply to Re: Circular reference testing.
in thread Circular reference testing.
Thanks for the supplying the full SP on SVs :)
...but you can't make any assumptions about SVs allocated from different arenas.
Would it be accurate to say that reference values stringified within Perl
(Do they becomes 16 or 24 bytes on 64-bit systems?)
Any thoughts on getting a rough value for the lowest and highest address that can be a reference at any given moment in time?
For the lowest, I've been looking through the source trying discover when the various system globals come into being. The thought being that maybe say $^X or $^O would be likely to be allocated pretty early and addresses below that are unlikely to come up in user datastructures, leastwise not as self references? Suggestions for the best choice?
For the top end, I've been thinking along the lines that any datastructure I am going to traverse already exists, so if I could force the allocation of a new SV, it's address would form an upper bound for my circular reference testing.
The fly in that ointment is that if I simple declare a new variable, I am quite likely to re-use an old one that has gone out of scope.
Do you know of any way that I could force the allocation of a completely new SV (header)?
I thought about allocating a largish array, big enough that it would force a new allocation from the OS and then use the address of the highest as my upper bound. I also thought that if the largish array was immediately undef'd and I then pre-allocated my bit-vector, it might get to re-use the same space.
From what you are saying, and what little I understand about the way Perl allocates memory, the space allocated for a long string is unlikely to re-use space allocated for a large array because they would be allocated from different pools?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Circular reference testing.
by Anonymous Monk on Mar 09, 2005 at 09:32 UTC | |
by BrowserUk (Patriarch) on Mar 09, 2005 at 11:04 UTC | |
by Anonymous Monk on Mar 09, 2005 at 11:38 UTC | |
by BrowserUk (Patriarch) on Mar 09, 2005 at 17:51 UTC |