[comp.lang.c] "malloc" and "free" on Quick-C for IBM

scott@max.u.washington.edu (11/06/90)

I have recently started programming in Quick-C but I have run into a
problem that I can't seems to figure it out. And it has to do with
the "malloc" and "free" statements.
I have examine the code careful and it seems that I mallocate and free
all the memory correctly. But each time I mallocate some memory and
then do a "_memavl", the value I get is the same one that I had before
I mallocated the memory. My C code is kind of long so I tried
different model sizes (medium and large), but no avail.
The C code compiles and links with no problem in any one the models
but its execution in the different models are bizzard. Some times is would
lock up soon after execution in one model but not in other, and if I
add some more C code or delete some, the result would be flipped.
Also if I manage to execute the program, and I run it several times,
it would lock-up or give me strange results after few times.
 
Does anyone know what is going on and/or what I am doing wrong?
 
I did write a small test C code to see if I was using "malloc" and
"free" correct, and in that test program everything executed as
expected with "_memavl" giving a smaller value after each "malloc".
 
I read about "far" pointers but I don't know how exactly use them.
Could anyone shed me some light on this matter?
 
Thanks in advance,
Scott K. Stephen
 
 
 
P.S.  As an aside, when testing the "malloc", it seems that when
      I initially free the mallocated pointer, I don't get back the same
      amount of memory than I had before, but subsequent malloc and
      free on that same pointer does. Is this normal?