Re: memory related concerns
- From: jaysome <jaysome@xxxxxxxxxxx>
- Date: Thu, 22 Jun 2006 01:20:02 -0700
On 22 Jun 2006 00:54:10 -0700, sam_cit@xxxxxxxxxxx wrote:
Hi,
Everybody, i have a situation where i receive data in a buffer and i
read the buffer and store it in a linked list, one the problem is i can
receive any number of data... so i might run out of the memory, and the
utiltimate aim is to return the header of the linked list to the caller
of the function, so that they can process the list and do the concerned
thing.
ht list is like this
struct list
{
int date;
struct *list
};
so having seen this limitation, is there any way of work around,
where i still can return the header of the node to the caller and don't
run out of memory simultaneously.
Yes, assuming that your code compiles.
Return the header of the node and add an argument that specifies
whether you ran out of memory. It might look something like this:
struct list* my_function(int *out_of_memory_ptr)
{
/* implementation that sets *out_of_memory_ptr
and returns the header of the node */
}
--
jay
.
- References:
- memory related concerns
- From: sam_cit
- memory related concerns
- Prev by Date: Re: near-TeraHertz processors no dream
- Next by Date: Re: Program to toggle nth bit in C
- Previous by thread: Re: memory related concerns
- Next by thread: Re: memory related concerns
- Index(es):
Relevant Pages
|