VirtualBox

Ticket #4568: Visual Studio Debugger.txt

File Visual Studio Debugger.txt, 4.7 KB (added by tigreci, 15 years ago)

This file is loaded from visual studio debugger when i push in Debug window when virtualbox crashed

Line 
1linea 103
2
3
4/***
5*free.c - free an entry in the heap
6*
7* Copyright (c) Microsoft Corporation. All rights reserved.
8*
9*Purpose:
10* Defines the following functions:
11* free() - free a memory block in the heap
12*
13*******************************************************************************/
14
15#ifdef WINHEAP
16
17#include <cruntime.h>
18#include <malloc.h>
19#include <winheap.h>
20#include <windows.h>
21#include <internal.h>
22#include <mtdll.h>
23#include <dbgint.h>
24#include <rtcsup.h>
25
26/***
27*void free(pblock) - free a block in the heap
28*
29*Purpose:
30* Free a memory block in the heap.
31*
32* Special ANSI Requirements:
33*
34* (1) free(NULL) is benign.
35*
36*Entry:
37* void *pblock - pointer to a memory block in the heap
38*
39*Return:
40* <void>
41*
42*******************************************************************************/
43
44void __cdecl _free_base (void * pBlock)
45{
46
47
48 if (pBlock == NULL)
49 return;
50
51 RTCCALLBACK(_RTC_Free_hook, (pBlock, 0));
52
53#ifndef _WIN64
54 if ( __active_heap == __V6_HEAP )
55 {
56 PHEADER pHeader;
57
58#ifdef _MT
59 _mlock( _HEAP_LOCK );
60 __try {
61#endif /* _MT */
62
63 if ((pHeader = __sbh_find_block(pBlock)) != NULL)
64 __sbh_free_block(pHeader, pBlock);
65
66#ifdef _MT
67 }
68 __finally {
69 _munlock( _HEAP_LOCK );
70 }
71#endif /* _MT */
72
73 if (pHeader == NULL)
74 HeapFree(_crtheap, 0, pBlock);
75 }
76#ifdef CRTDLL
77 else if ( __active_heap == __V5_HEAP )
78 {
79 __old_sbh_region_t *preg;
80 __old_sbh_page_t * ppage;
81 __old_page_map_t * pmap;
82#ifdef _MT
83 _mlock(_HEAP_LOCK );
84 __try {
85#endif /* _MT */
86
87 if ( (pmap = __old_sbh_find_block(pBlock, &preg, &ppage)) != NULL )
88 __old_sbh_free_block(preg, ppage, pmap);
89
90#ifdef _MT
91 }
92 __finally {
93 _munlock(_HEAP_LOCK );
94 }
95#endif /* _MT */
96
97 if (pmap == NULL)
98 HeapFree(_crtheap, 0, pBlock);
99 }
100#endif /* CRTDLL */
101 else // __active_heap == __SYSTEM_HEAP
102#endif /* _WIN64 */
103 {
104 HeapFree(_crtheap, 0, pBlock);
105 }
106}
107
108
109#else /* WINHEAP */
110
111
112#include <cruntime.h>
113#include <heap.h>
114#include <malloc.h>
115#include <mtdll.h>
116#include <stdlib.h>
117#include <dbgint.h>
118
119/***
120*void free(pblock) - free a block in the heap
121*
122*Purpose:
123* Free a memory block in the heap.
124*
125* Special Notes For Multi-thread: The non-multi-thread version is renamed
126* to _free_lk(). The multi-thread free() simply locks the heap, calls
127* _free_lk(), then unlocks the heap and returns.
128*
129*Entry:
130* void *pblock - pointer to a memory block in the heap
131*
132*Return:
133* <void>
134*
135*******************************************************************************/
136
137#ifdef _MT
138
139void __cdecl _free_base (
140 void *pblock
141 )
142{
143 /* lock the heap
144 */
145 _mlock(_HEAP_LOCK);
146
147 /* free the block
148 */
149 _free_base_lk(pblock);
150
151 /* unlock the heap
152 */
153 _munlock(_HEAP_LOCK);
154}
155
156
157/***
158*void _free_lk(pblock) - non-locking form of free
159*
160*Purpose:
161* Same as free() except that no locking is performed
162*
163*Entry:
164* See free
165*
166*Return:
167*
168*******************************************************************************/
169
170void __cdecl _free_base_lk (
171
172#else /* _MT */
173
174void __cdecl _free_base (
175
176#endif /* _MT */
177
178 REG1 void *pblock
179 )
180{
181 REG2 _PBLKDESC pdesc;
182
183
184 /*
185 * If the pointer is NULL, just return [ANSI].
186 */
187
188 if (pblock == NULL)
189 return;
190
191 /*
192 * Point to block header and get the pointer back to the heap desc.
193 */
194
195 pblock = (char *)pblock - _HDRSIZE;
196 pdesc = *(_PBLKDESC*)pblock;
197
198 /*
199 * Validate the back pointer.
200 */
201
202 if (_ADDRESS(pdesc) != pblock)
203 _heap_abort();
204
205 /*
206 * Pointer is ok. Mark block free.
207 */
208
209 _SET_FREE(pdesc);
210
211 /*
212 * Check for special conditions under which the rover is reset.
213 */
214 if ( (_heap_resetsize != 0xffffffff) &&
215 (_heap_desc.proverdesc->pblock > pdesc->pblock) &&
216 (_BLKSIZE(pdesc) >= _heap_resetsize) )
217 {
218 _heap_desc.proverdesc = pdesc;
219 }
220 else if ( _heap_desc.proverdesc == pdesc->pnextdesc )
221 {
222 _heap_desc.proverdesc = pdesc;
223 }
224}
225
226#endif /* WINHEAP */

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy