Giter VIP home page Giter VIP logo

Comments (3)

minfrin avatar minfrin commented on May 31, 2024

Hmmm...

What made the problem go away was to set the prompt to a single unchanging string, and pass the string:

        result = readline(prompt);

It seems that references to prompt are kept around internally after readline() returns. If an attempt is made to clean up the prompt or regenerate the prompt, chaos follows. I suspect somewhere inside the prompt needs to be strdup'ed.

from editline.

troglobit avatar troglobit commented on May 31, 2024

In the original code there's no way to free stuff, so it's made to use a static string, or only change the contents of prompt between calls to readline().

Note: this is a very small an limited library. If you need anything more advanced I suggest looking at libedit (or readline) instead).

from editline.

minfrin avatar minfrin commented on May 31, 2024

Alas in this case I'm only making changes to the contents of prompt in between calls to readline(), but it's not working in this case.

If I hack the code to not free prompt (ie leak), the problem disappears.

Ideally if editline needs to keep prompt past the readline() call, it should strdup it (and then free). Alternatively, store the prompt length only if that is all that's needed.

At this stage we support libedit, but this is not available where we want to run. Readline is not an option because of GPL.

from editline.

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.