Git Product home page Git Product logo

Comments (5)

janus avatar janus commented on September 26, 2024

Wow.. now I understood the error message I was getting.

You have a few errors:

You're trying to free memory that's not heap memory. Don't do that.

You're trying to free the inside of a block of memory. When you have in fact allocated a block of memory, you can only free it from the pointer returned by malloc. That is to say, only from the beginning of the block. You can't free a portion of the block from the inside.

http://stackoverflow.com/questions/20297524/c-free-invalid-pointer

from citrine.

gabordemooij avatar gabordemooij commented on September 26, 2024

Yes this needs some work.

from citrine.

janus avatar janus commented on September 26, 2024

I just tried something after meditating over this issue. I found that ctr_build_string accepts strings on the heap and stack, and that is why it trigged free invalid pointer error. So, this is what I did and it passed test cases. I found every function inside base.c file that calls ctr_build_string and for anyone that has string on the heap I added the below:

ctr_object* result;
result = return ctr_build_string(dest, nlent);
free(dest);
return result;

Please go through and comment. I tend to spend more time studying and assimilating citrine source code.

from citrine.

gabordemooij avatar gabordemooij commented on September 26, 2024

maybe a macro would be better for this?

from citrine.

gabordemooij avatar gabordemooij commented on September 26, 2024

I think this issue is no longer relevant, most/all memory issues in String, File, Map and Array have been fixed. I only need to test Nil, Object, Boolean, Number, Blocks and the system library but these are low risk and easy to test.

from citrine.

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.