Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

say() on self-recursive object invokes OOM killer #3771

Closed
p6rt opened this issue Apr 4, 2015 · 5 comments
Closed

say() on self-recursive object invokes OOM killer #3771

p6rt opened this issue Apr 4, 2015 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Apr 4, 2015

Migrated from rt.perl.org#124242 (status was 'resolved')

Searchable as RT124242$

@p6rt
Copy link
Author

p6rt commented Apr 4, 2015

From @drforr

OS​: Ubuntu 14.04 LTS in VirtualBox
Host​: Windows 8, Intel Core i5 Dual

Rakudo version​:
This is perl6 version 2015.03-159-g4afc9e9 built on MoarVM version
2015.03-45-ge0f1cb0

The code below creates a self-referencing object then tries to print it.
Creating the self-reference proceeds normally but any attempt to print
it, even with the .perl modifier, ends up invoking the OOM killer, I'm
guessing as it goes round-and-round the object tree, which now has a
loop in it. I haven't tried to see if changing @​.myself to $.myself has
any effect because trying the normal things causes a different
compile-time error.

--cut here--
class Bug {
  has @​.myself;
  method bind( $myself ) {
  @​.myself[0] = $myself;
  }
}

my $a1 = Bug.new;

$a1.bind( $a1 );

say $a1;
--cut here--

@p6rt
Copy link
Author

p6rt commented Sep 24, 2015

From @coke

This now works​:

$ ./perl6 rt124242.p6
Bug.new(myself => (my \Array_4544383328 = [Bug.new(myself => Array_4544383328)]))

Closeable with tests.
--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Sep 24, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 24, 2015

From @niner

Tests added in roast commit 95a6e7723fa09dbf79df0ca664d591b941b4f893

@p6rt p6rt closed this as completed Sep 24, 2015
@p6rt
Copy link
Author

p6rt commented Sep 24, 2015

@niner - Status changed from 'open' to 'resolved'

@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant