When coding in C, in code that I can free externally without leaks (tested with valgrind), I have been receiving several annoying misaligned bytes messages (indicating that e.g. something tried to use array access with pointers or vice versa, that sort of thing) or errors allocating memory. I do habitually adopt conventions like freeing my own memory and returning null when a malloc call fails, should I not be doing this? Would it be possible to provide some guidelines for test developers as far as providing information to coders so we know exactly how memory will be freed? This happens most often with, for instance, linked lists or 2-D arrays, in which most coders will be naturally inclined to allocate multiple blocks of memory. If we should allocate a single block of memory to hold everything and try to index within that block, please let us know. Otherwise, generally, the way things are this breaks testing code on our own compilers, and introduces problems completely unrelated to the computer science problems we are trying to solve that are much, much more complicated.
Some template code as far as allocating memory, or even methods we can call such as
newObject()
object->addRow(varArgsInteger 1, varArgsInteger 2, ...)
would be very awesome. I would be happy writing a
object->free()
method on my own for solutions if you want to shift responsibility back to me, just template this out please.