Giter Club home page Giter Club logo

Comments (7)

Majored avatar Majored commented on August 16, 2024

Ignore the previous comment if you saw it.

Initially thought this could be a stdlib/rustc issue since the overflow was occurring between async function calls, only on Windows (couldn't reproduce on MacOS), and only in debug mode. Whilst it may still be, at least part of the cause seems to be the buffer size chosen for part of the reading. It was 64kb, which doesn't seem insane to me but apparently is too much in debug mode.. I guess?

At least a short term solution is to reduce it down to 16kb I guess, but that does also impact perf.

from rs-async-zip.

Majored avatar Majored commented on August 16, 2024

I'll look into the specifics of this in the future but I've gone and reduced it.

Should be fixed in version 0.0.7. 👍

from rs-async-zip.

damccull avatar damccull commented on August 16, 2024

That sounds like a silly issue. Why would a read buffer of 64kb be too big in debug mode? I'll test moving my code into main for you and get back. Obviously more performance is better.

from rs-async-zip.

damccull avatar damccull commented on August 16, 2024

FYI @Majored, works fine with just main for me too. I asked around on rust discord. Seems the Windows stack is only about 1mb where unix/linux has a higher stack size. So, if you're allocating more than that it's causing an issue. They suggest using a Vec if needing more, which I think is because it stores those on the heap.

from rs-async-zip.

Majored avatar Majored commented on August 16, 2024

Understand that, but that buffer is only ~6% of that stack size on Windows. There really shouldn't be too much else on the stack so the fact that the size is ballooning in debug mode is still just weird to me - along with the fact that removing that single indirection of the print_p4k_contents() fn is the difference between overflowing and not.

I feel like there's something else going on there but honestly, could be completely wrong. I'll leave it as is now with the reduced size. Want to keep everything stack-allocated where it can be.

from rs-async-zip.

damccull avatar damccull commented on August 16, 2024

Ok, just wanted to give you the info I found. I forgot to mention in the previous comment: They also said the compiler may be helpfully optimizing out the stack requirement when it's in main, and just skipping it entirely.

from rs-async-zip.

Majored avatar Majored commented on August 16, 2024

Ah, that makes a lot more sense then.

Thanks :)

from rs-async-zip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.