Problem with exercism Forth Exercise. alloc_attack test fail

Hello i write like 5 difrent code of the Exercise and i have all the time alloc_attack test fail. When i look at my code i dont think i allocate that much heap memory thats why i ma counfiused. I will be glad for help if someone direct me where i make error. And how alloc_attack test my code.

Version of my code i thnik is the best

Hi there. Please open a mentoring request for help with specific exercises.

Without looking at your code, the alloc_attack test is designed to guard against implementations that can be made to allocate a lot with specific inputs.

This is a challenging exercise, so I recommend you read the source of the alloc_attack test and try to understand why these particular inputs are causing your implementation to perform inefficiently.

Making the alloc_attack test pass is the hardest part of the exercise, so giving too much help here defeats the purpose of the exercise.

Thank you for a answer i tryed find alloc_attack source code but i cant find it. Mby u have a link to it ?

That’s a good point. It doesn’t show up in the editor. I think I can improve this. Until then, you can either work locally with the exercism CLI, that should give you all the files, or you can get it straight from our repo: https://github.com/exercism/rust/blob/main/exercises/practice/forth/tests/alloc-attack.rs

Wait, no. It does show up. In the online editor, you have to click on tests and then alloc-attach:

thx u very much for help

1 Like