Giter Club home page Giter Club logo

Comments (5)

suborb avatar suborb commented on May 29, 2024

So it's obviously the heap size:

        {
            unsigned int total, largest;
            mallinfo(&total, &largest);
            printf("Heap size %u largest block %u\n",total, largest);
        }
Heap size 30045 largest block 30045 bdos 59398
8192 bytes read
8192 bytes write
Heap size 21851 largest block 21851 bdos 59398
8192 bytes read
8192 bytes write
Heap size 13657 largest block 13657 bdos 59398
8192 bytes read
8192 bytes write
Heap size 5463 largest block 5463 bdos 59398
out of memory

By default it's meant to use 3/4 of the free memory between _bss_tail to the stack pointer. It's obviously not, and the override to set the top of the heap isn't working either.

I'll sort it out.

from z88dk.

sgjava avatar sgjava commented on May 29, 2024

It's weird that it's leaking memory as I'm using the same buffer over and over. Another program I have (much more code) hangs using even 1024 buffer. I'll wait until you identify root cause and push fix and test again. Thanks so much for fixing this stuff.

from z88dk.

suborb avatar suborb commented on May 29, 2024

You're allocating a buffer in main and inside readAndWriteFile which is inside the loop

I didn't spot the one outside initially and I've been chasing down a missing 8k of memory. Doh!

So yeah, the problem with this test case is the memory leak!

from z88dk.

sgjava avatar sgjava commented on May 29, 2024

I botched that, hold on, let me fix...

from z88dk.

sgjava avatar sgjava commented on May 29, 2024

My bad, let me close this out and get you a real example from a larger app with bdos calls, etc. Anyways, that was a z88dk hacker rank test, hahahaha

from z88dk.

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.