Author Topic: GCC for eCS: Pecularities re malloc, memcpy, and free with C structures ?  (Read 1816 times)

agena@alex

  • Newbie
  • *
  • Thank You
  • -Given: 14
  • -Receive: 6
  • Posts: 36
    • View Profile
Hello,

I am just trying to port C code to eCS implementing binary trees, that has run smoothly even in stress
tests with Valgrind - a memory leak checker for Linux and Mac OS X - being plugged in.

Tomorrow, one of our best C programmers at my company will check my code for errors. However,
since the crashes in eCS diminished significantly - but not vanished - when not memcpy'ing C structures
into other C structures, by just using assignment statements instead: is there anything special with memory
management in eCS ?  The errors happen when removing a large number of nodes from the tree, `only`.

I just read a non-eCS related comment on StackOverflow saying that using assignments instead of
memcpy could confuse the system if the structure to be copied resided on the internal C heap.

Thank you,

Alex
« Last Edit: September 10, 2014, 08:07:34 pm by agena@alex »