realloc freed memory

realloc freed memory

Post by Vic Dur » Sun, 05 Jan 2003 19:11:40



Hello,

When realloc is used to free excess memory that was previously
allocated, does the freed memory become available for reuse by the
program or operating system (Win98se)?

If not, what happens to the freed memory?

Thanks for any comments.

Regards,
Vic Dura

--
Performing Arts in the Shoals Area
Shoals Symphony Orchestra at UNA: http://www.ShoalsSymphony.org/
Opera South: http://www.OperaSouth.org/

 
 
 

realloc freed memory

Post by John » Sun, 05 Jan 2003 19:34:37



Quote:> Hello,

> When realloc is used to free excess memory that was previously
> allocated, does the freed memory become available for reuse by the
> program or operating system (Win98se)?

> If not, what happens to the freed memory?

I believe that memory freed with realloc behaves exactly like memory freed
with free().

John

 
 
 

realloc freed memory

Post by Steve Manle » Mon, 06 Jan 2003 05:07:46




> > Hello,

> > When realloc is used to free excess memory that was previously
> > allocated, does the freed memory become available for reuse by the
> > program or operating system (Win98se)?

> > If not, what happens to the freed memory?

The freed memory is released for re-use in your process heap. This
doesn't mean it can be used in another process. If the operating
system does heap defragmentation and/or compaction, the memory
may be released for use by another process.

Steve M

 
 
 

realloc freed memory

Post by Vic Dur » Mon, 06 Jan 2003 06:21:51


On Sat, 4 Jan 2003 10:34:37 -0000,  RE: Re: realloc freed memory




>> Hello,

>> When realloc is used to free excess memory that was previously
>> allocated, does the freed memory become available for reuse by the
>> program or operating system (Win98se)?

>> If not, what happens to the freed memory?

>I believe that memory freed with realloc behaves exactly like memory freed
>with free().

Well that makes sense and seems pretty obvious now that you mention
it. Sometimes I'm amazed at how I can miss the simplest concepts :-)

--
Performing Arts in the Shoals Area
Shoals Symphony Orchestra at UNA: http://www.ShoalsSymphony.org/
Opera South: http://www.OperaSouth.org/

 
 
 

1. Memory allocation and realloc

--MimeMultipartBoundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I am trying to use realloc to allocate a growing block of memory.  I
have been able to use it with other O/S's , particularly Windows NT 4.0,
but with VxWorks, I get a mempartfree error on the second realloc.

Here is the code:
...
    syncFile *files;
    size = 0;
    count = 0;
    while(readfile)
    {
      size++;
      files = (syncFile *) realloc( files, sizeof(syncFile) * size);
      count++;
    }
...
syncFile is a basic structure.

The idea is to grow the files array with each item read from the file.
On the second realloc I get a memPartRealloc: invalid block xxxx in
partition xxxx.

Is this the proper way to allocate memory with VxWorks or do I need to
create a memory partition first.

Thanks.
JB

--MimeMultipartBoundary--

2. WWW FAQ 'n copyright ?

3. Memory fragmentation with realloc()

4. surveilance or parental concern ???

5. about realloc memo in TornadoII

6. UCX and $ show users/full -- domain names get truncated!

7. A problem with realloc

8. VxWorks, PPC, & cPCI?

9. realloc bug in MSL?

10. realloc down

11. realloc problem

12. FREE!!!FREE!!! XBOX -Just Pure Free-nest