导读:
malloc.c属于C的运行时函数库(C Runtime Library)文件
VC安装时默认没有把代码复制到硬盘,可以通过添加删除组件把文件复制到硬盘上
VC++ Runtime Libraries / CRT Source Code
这样在C:/Program Files/Microsoft Visual Studio/VC98下会出现一个CRT的文件夹
malloc.c文件的地址是:
C:/Program Files/Microsoft Visual Studio/VC98/CRT/SRC/malloc.c
/***
*malloc.c - Get a block of memory from the heap
*
* Copyright (c) 1989-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the malloc() function.
*
*******************************************************************************/
#include
#include
#include
#include
#include
#ifdef WINHEAP
#include
#include
#else /* WINHEAP */
#include
#endif /* WINHEAP */
extern int _newmode; /* malloc new() handler mode */
/***
*void *malloc(size_t size) - Get a block of memory from the heap
*
*Purpose:
* Allocate of block of memory of at least size bytes from the heap and
* return a pointer to it.
*
* Calls the new appropriate new handler (if installed).
*
*Entry:
* size_t size - size of block requested
*
*Exit:
* Success: Pointer to memory block
* Failure: NULL (or some error value)
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/
void * __cdecl _malloc_base (size_t size)
*malloc.c - Get a block of memory from the heap
*
* Copyright (c) 1989-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the malloc() function.
*
*******************************************************************************/
#include
#include
#include
#include
#include
#ifdef WINHEAP
#include
#include
#else /* WINHEAP */
#include
#endif /* WINHEAP */
extern int _newmode; /* malloc new() handler mode */
/***
*void *malloc(size_t size) - Get a block of memory from the heap
*
*Purpose:
* Allocate of block of memory of at least size bytes from the heap and
* return a pointer to it.
*
* Calls the new appropriate new handler (if installed).
*
*Entry:
* size_t size - size of block requested
*
*Exit:
* Success: Pointer to memory block
* Failure: NULL (or some error value)
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/
void * __cdecl _malloc_base (size_t size)