so if I do say
should I have a?
or is it for when you create pointers?
and how would you go about disposing of the freed memory, it's managed by the O/S ? or you have to manually write "null" to that memory address ?
For some reason, I'm having a bit of a brain fart here and cannot think of a simple solution to this problem...
We have a samba server installed on one of our Darwin boxes. Someone is doing massive amounts of work through a samba share, and in turn in pegging samba and the box. I can see how... (1 Reply)
I currently access a remote Unix server which has an external modem connected to one of it's serial ports (/dev/cua/b). At times, this server undergoes a hard reset and for some reason this disallows us from making use of the modem any longer. A hard reset of the modem always seems to fix the... (0 Replies)
Hi,
I got a solarsi 10 box with 9 zones and the cpu shares as following
ID NAME SHARES
0 global 1
1 FMW1 100
2 FMW2 100
3 OID1 100
4 OID2 100
5 OVD1 100
6 OID0 100
7 FMW5 100
8... (2 Replies)
Hello,
I am trying to free memory allocation after EOF from keyboard is detected (ctrl+D) in a C program. I've written a small program to replicate my problem:
int main(int argc, char *argv) {
char *line;
line = (char*)malloc(sizeof(char)*(512));
line = fgets(line, 512,... (1 Reply)
Hello,
I am trying to free memory allocation after EOF from keyboard is detected (ctrl+D) in a C program. I've written a small program to replicate my problem:
int main(int argc, char *argv) {
char *line;
line = (char*)malloc(sizeof(char)*(512));
line = fgets(line, 512,... (10 Replies)
Here is a list of resources for Unix and GNU/Linux bootloaders:
GRUB Legacy: The original GRand Unified Bootloader. Now known as GRUB Legacy.
GRUB: The latest and greatest. More commonly known as GRUB2.
BRUG: Brand-new Universal loadeR from GRUB. Based on GRUB. Adds features like new object... (0 Replies)
Hi guys,
I wrote a basic inotifywait shell script on my CentOS 5.6 x86_64 test server that syncs any deleted files in a directory.
/usr/bin/script
#!/bin/sh
inotifywait -m -e delete /home/user/test | while read file; do
# log event here
done
The script alone works fine. However, the... (4 Replies)
:)Hi all,
Please advice me is it safer to use the following command to free up (truncate) space in HDD.
1) > /usr/adm/messages
2) > /usr/adm/sulog
3) > /usr/adm/ctlog
4) > /tmp
5) > /usr/adm/sa
6) > /var/spool
Thanks in advance
Rukshan (1 Reply)
Discussion started by: rukshan4u2c
1 Replies
LEARN ABOUT DEBIAN
bsdmalloc
bsdmalloc(3MALLOC)bsdmalloc(3MALLOC)NAME
bsdmalloc - memory allocator
SYNOPSIS
cc [ flag ... ] file ... -lbsdmalloc [ library ... ]
char *malloc(size);
unsigned size;
int free( ptr);
char *ptr;
char *realloc( ptr, size);
char *ptr;
unsigned size;
These routines provide a general-purpose memory allocation package. They maintain a table of free blocks for efficient allocation and coa-
lescing of free storage. When there is no suitable space already free, the allocation routines call sbrk(2) to get more memory from the
system. Each of the allocation routines returns a pointer to space suitably aligned for storage of any type of object. Each returns a
null pointer if the request cannot be completed.
The malloc() function returns a pointer to a block of at least size bytes, which is appropriately aligned.
The free() function releases a previously allocated block. Its argument is a pointer to a block previously allocated by malloc() or real-
loc(). The free() function does not set errno.
The realloc() function changes the size of the block pointed to by ptr to size bytes and returns a pointer to the (possibly moved) block.
The contents will be unchanged up to the lesser of the new and old sizes. If the new size of the block requires movement of the block, the
space for the previous instantiation of the block is freed. If the new size is larger, the contents of the newly allocated portion of the
block are unspecified. If ptr is NULL, realloc() behaves like malloc() for the specified size. If size is 0 and ptr is not a null pointer,
the space pointed to is freed.
The malloc() and realloc() functions return a null pointer if there is not enough available memory. They return a non-null pointer if size
is 0. These pointers should not be dereferenced. When realloc() returns NULL, the block pointed to by ptr is left intact. Always cast the
value returned by malloc() and realloc().
If malloc() or realloc() returns unsuccessfully, errno will be set to indicate the following:
ENOMEM size bytes of memory cannot be allocated because it exceeds the physical limits of the system.
EAGAIN There is not enough memory available at this point in time to allocate size bytes of memory; but the application could try
again later.
Using realloc() with a block freed before the most recent call to malloc() or realloc() results in an error.
Comparative features of the various allocation libraries can be found in the umem_alloc(3MALLOC) manual page.
brk(2), malloc(3C), malloc(3MALLOC), mapmalloc(3MALLOC), umem_alloc(3MALLOC)WARNINGS
Use of libbsdmalloc renders an application non-SCD compliant.
The libbsdmalloc routines are incompatible with the memory allocation routines in the standard C-library (libc): malloc(3C), alloca(3C),
calloc(3C), free(3C), memalign(3C), realloc(3C), and valloc(3C).
21 Mar 2005 bsdmalloc(3MALLOC)