MALLOC_SIZE(3) BSD Library Functions Manual MALLOC_SIZE(3)NAME
malloc_good_size, malloc_size -- memory allocation information
SYNOPSIS
#include <malloc/malloc.h>
size_t
malloc_good_size(size_t size);
size_t
malloc_size(const void *ptr);
DESCRIPTION
The malloc_size() function returns the size of the memory block that backs the allocation pointed to by ptr. The memory block size is always
at least as large as the allocation it backs, and may be larger.
The malloc_good_size() function rounds size up to a value that the allocator implementation can allocate without adding any padding; it then
returns that rounded-up value.
SEE ALSO malloc(3)BSD May 23, 2006 BSD
Check Out this Related Man Page
MALLOC(3) BSD Library Functions Manual MALLOC(3)NAME
reallocf -- general purpose memory allocation functions
LIBRARY
Utility functions from BSD systems (libbsd, -lbsd)
SYNOPSIS
#include <bsd/stdlib.h>
void *
reallocf(void *ptr, size_t size);
DESCRIPTION
The reallocf() function changes the size of the previously allocated memory referenced by ptr to size bytes. The contents of the memory are
unchanged up to the lesser of the new and old sizes. If the new size is larger, the contents of the newly allocated portion of the memory
are undefined. Upon success, the memory referenced by ptr is freed and a pointer to the newly allocated memory is returned. Note that
reallocf() may move the memory allocation, resulting in a different return value than ptr. If ptr is NULL, the reallocf() function behaves
identically to malloc() for the specified size. Upon failure, when the requested memory cannot be allocated, the passed pointer is freed to
ease the problems with traditional coding styles for reallocf() causing memory leaks in libraries.
RETURN VALUES
The reallocf() function returns a pointer, possibly identical to ptr, to the allocated memory if successful; otherwise a NULL pointer is
returned, and errno is set to ENOMEM if the error was the result of an allocation failure. The buffer is deallocated in this case.
SEE ALSO brk(2), mmap(2), alloca(3), calloc(3), free(3), malloc(3), posix_memalign(3), realloc(3),
HISTORY
The reallocf() function first appeared in FreeBSD 3.0.
BSD September 26, 2009 BSD
Hello!
Can anybody suggest about the fastest way of extracting "n" random columns from a very large file (tab separated) having thousands of columns, where n can be any specified number.
Thanks! (10 Replies)
How do I know what parts of the application to monitor and what means do I use to get this data? Can I use proc? What interactions are important and how do I view them?I would be more descriptive but I have not a clue.
Thanks in... (18 Replies)
Hi,
I have a parametrized memory mem.
I want to fill this memory with random numbers with respect to the data_width.
can anyone help me on this.. (3 Replies)
I am writing matrix multiplication and trying to return a two dimensional array from a function but I keep getting errors. Can someone please help me?
here is my code (it is just the skeleton of my program):
void main ()
{
...
int *matmultiply (int, int, int, int , int , int )
...
}
... (4 Replies)
Dear all,
Currently I am implementing ECC protocols. I used tinyECC package to port ecc to contiki os. This giving me a segmentation fault.
I followed some article Debugging Segmentation Faults and Pointer Problems - Cprogramming.com but I failed to detect the error. Please help me to find... (11 Replies)
Good day! I'm a newbie in C. I'm trying to get an unlimited input from the user using malloc then printing the inputs after the user presses enter. My code works, but there's a warning that I don't know how to fix. Please help me. Thank you.
Here's my code:
#include <stdio.h>
#include... (6 Replies)
Hello,
I am trying to read a text file into linked list, but always got the first and last records wrong.
1) The problem looks related to the initialization of the node temp with malloc(), but could not figure it out. No error/warning at compiling, though.
2) The output file is empty,... (10 Replies)
Hello, I am trying to concatenate two strings by merging the overlapped region. E.g.
Seq1=ACGTGCCC
Seq2=CCCCCGTGTGTGT
Seq_merged=ACGTGCCCCCGTGTGTGTFunction strcat(char *dest, char *src) appends the src string to the dest string, ignoring the overlapped parts (prefix of src and suffix of dest).... (30 Replies)
I am building a wrapper around fgets, and fighting crashes for no reason I can explain.
I have stripped it down as far as I can and it still crashes.
#include <stdio.h>
#include <stdlib.h>
typedef struct {
char buf;
FILE *fp;
int type;
} wrap;
wrap... (12 Replies)
I have an array in an external file, "array.txt", which contains:
char *testarray={"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};I want to be able to add an element to this array, and have that element display, whenever I call it, without having to recompile... (29 Replies)