Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Timeline for Build a Compiler Bomb

Current License: CC BY-SA 3.0

12 events
when toggle format what by license comment
Feb 17, 2021 at 19:58 comment added Aleksi Torhamo @AnshumanKumar: In Python interactive shell? If you put it into a variable (so eg. v = (1<<19**8,)*4**7), and you have enough free memory (a bit over 2GB), nothing much - it'll take a second or two to complete, and the process will use that much more memory. If you don't put it into a variable, Python will try to display the number, which means it needs to convert it to decimal first - which will take some time (and more memory) with a number that big. How long? Depends on the computer, but on the order of a year. But after that, it should finally print the multi-gigabyte output for you!
Feb 17, 2021 at 19:56 comment added aivarsk Just a 2021 update: constant folding has been fixed in current versions of Python3. I managed to reproduce the compiler bomb with python3.5 from deadsnakes PPA.
Feb 17, 2021 at 15:24 comment added Anshuman Kumar Honest question : If I run this in my terminal what will happen?
Jun 17, 2020 at 9:04 history edited Community Bot
Commonmark migration
Oct 6, 2016 at 23:34 comment added user16488 IIRC, python uses 30 bits per 32-bit word in its integer representation
Jan 17, 2016 at 21:17 comment added Aleksi Torhamo @Dave: Ahhh, I totally misunderstood what you meant. :P
Jan 17, 2016 at 21:04 comment added Dave @AleksiTorhamo it's small because I had to change it to 1<<18**8 instead of 1<<19**8. The full version failed with an invalid IO operation (so I'll check it on another OS & filesystem)
Jan 17, 2016 at 18:17 comment added Aleksi Torhamo @Dave: The exact size might depend on the version (1.5GB sounds weird no matter what, though); I was using Python 3.3.5, and used python -m py_compile asd.py to generate the .pyc-file.
Jan 17, 2016 at 17:22 comment added Dave Nice. Since this is only 13 bytes, we finally have a challenger to the first-posted answer! I was only able to confirm 1<<18 on my machine (1.5GB) but I'll test it on linux later, where I expect it will work with the full 8GB (not going to try the 32TB version!)
Jan 15, 2016 at 8:29 history edited Aleksi Torhamo CC BY-SA 3.0
Use smaller code that still generates >4GB output for a better "score"
Jan 14, 2016 at 10:46 comment added Aleksi Torhamo @ChristianIrwan: Yeah, I'd forgotten that rule, only realized it a few minutes ago and haven't figured out what kind of edit I should make yet. :-)
Jan 14, 2016 at 8:58 history answered Aleksi Torhamo CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /