#include <stdlib.h>#include <string.h>#include "glib.h"Go to the source code of this file.
|
|
Definition at line 69 of file gmem.c. Referenced by g_mem_chunk_alloc(), g_mem_chunk_destroy(), g_mem_chunk_free(), and g_mem_chunk_new(). |
|
|
Definition at line 70 of file gmem.c. Referenced by g_mem_chunk_alloc(), g_mem_chunk_destroy(), g_mem_chunk_free(), and g_mem_chunk_new(). |
|
|
Definition at line 79 of file gmem.c. Referenced by g_mem_chunk_new(). |
|
|
Definition at line 74 of file gmem.c. Referenced by g_mem_chunk_alloc(), and g_mem_chunk_new(). |
|
|
Definition at line 42 of file gmem.c. Referenced by g_malloc(), g_malloc0(), g_mem_profile(), and g_realloc(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 988 of file gmem.c. References g_free(), g_mem_chunk_destroy(), g_return_if_fail, _GAllocator::is_unused, _GAllocator::mem_chunk, _GAllocator::name, NULL, and TRUE. 00989 { 00990 g_return_if_fail (allocator != NULL); 00991 g_return_if_fail (allocator->is_unused == TRUE); 00992 00993 g_free (allocator->name); 00994 if (allocator->mem_chunk) 00995 g_mem_chunk_destroy (allocator->mem_chunk); 00996 00997 g_free (allocator); 00998 }
|
|
||||||||||||
|
Definition at line 968 of file gmem.c. References CLAMP, _GAllocator::dummy, g_new0, g_return_val_if_fail, g_strdup(), _GAllocator::is_unused, _GAllocator::last, _GAllocator::mem_chunk, _GAllocator::n_preallocs, _GAllocator::name, NULL, TRUE, and _GAllocator::type. Referenced by g_list_alloc(), g_node_new(), and g_slist_alloc(). 00970 { 00971 GAllocator *allocator; 00972 00973 g_return_val_if_fail (name != NULL, NULL); 00974 00975 allocator = g_new0 (GAllocator, 1); 00976 allocator->name = g_strdup (name); 00977 allocator->n_preallocs = CLAMP (n_preallocs, 1, 65535); 00978 allocator->is_unused = TRUE; 00979 allocator->type = 0; 00980 allocator->last = NULL; 00981 allocator->mem_chunk = NULL; 00982 allocator->dummy = NULL; 00983 00984 return allocator; 00985 }
|
|
|
Definition at line 895 of file gmem.c. References g_mem_chunk_clean(), g_mutex_lock, g_mutex_unlock, and mem_chunks_lock. 00896 { 00897 GRealMemChunk *mem_chunk; 00898 00899 g_mutex_lock (mem_chunks_lock); 00900 mem_chunk = mem_chunks; 00901 g_mutex_unlock (mem_chunks_lock); 00902 while (mem_chunk) 00903 { 00904 g_mem_chunk_clean ((GMemChunk*) mem_chunk); 00905 mem_chunk = mem_chunk->next; 00906 } 00907 }
|
|
|
|
Definition at line 154 of file gmem.c. References g_error(), g_mutex_lock, g_mutex_unlock, MEM_PROFILE_TABLE_SIZE, and NULL. Referenced by g_get_any_init(), g_getenv(), g_mem_chunk_alloc(), g_memdup(), and g_relation_select(). 00155 { 00156 gpointer p; 00157 00158 00159 #if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK) 00160 gulong *t; 00161 #endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */ 00162 00163 00164 if (size == 0) 00165 return NULL; 00166 00167 00168 #if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK) 00169 size += SIZEOF_LONG; 00170 #endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */ 00171 00172 #ifdef ENABLE_MEM_CHECK 00173 size += SIZEOF_LONG; 00174 #endif /* ENABLE_MEM_CHECK */ 00175 00176 00177 p = (gpointer) malloc (size); 00178 if (!p) 00179 g_error ("could not allocate %ld bytes", size); 00180 00181 00182 #ifdef ENABLE_MEM_CHECK 00183 size -= SIZEOF_LONG; 00184 00185 t = p; 00186 p = ((guchar*) p + SIZEOF_LONG); 00187 *t = 0; 00188 #endif /* ENABLE_MEM_CHECK */ 00189 00190 #if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK) 00191 size -= SIZEOF_LONG; 00192 00193 t = p; 00194 p = ((guchar*) p + SIZEOF_LONG); 00195 *t = size; 00196 00197 #ifdef ENABLE_MEM_PROFILE 00198 g_mutex_lock (mem_profile_lock); 00199 # ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS 00200 if(!IS_IN_MEM_CHUNK_ROUTINE()) { 00201 # endif 00202 if (size <= MEM_PROFILE_TABLE_SIZE - 1) 00203 allocations[size-1] += 1; 00204 else 00205 allocations[MEM_PROFILE_TABLE_SIZE - 1] += 1; 00206 allocated_mem += size; 00207 # ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS 00208 } 00209 # endif 00210 g_mutex_unlock (mem_profile_lock); 00211 #endif /* ENABLE_MEM_PROFILE */ 00212 #endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */ 00213 00214 00215 return p; 00216 }
|
|
|
Definition at line 219 of file gmem.c. References g_error(), g_mutex_lock, g_mutex_unlock, MEM_PROFILE_TABLE_SIZE, and NULL. 00220 { 00221 gpointer p; 00222 00223 00224 #if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK) 00225 gulong *t; 00226 #endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */ 00227 00228 00229 if (size == 0) 00230 return NULL; 00231 00232 00233 #if defined (ENABLE_MEM_PROFILE) || defined (ENABLE_MEM_CHECK) 00234 size += SIZEOF_LONG; 00235 #endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */ 00236 00237 #ifdef ENABLE_MEM_CHECK 00238 size += SIZEOF_LONG; 00239 #endif /* ENABLE_MEM_CHECK */ 00240 00241 00242 p = (gpointer) calloc (size, 1); 00243 if (!p) 00244 g_error ("could not allocate %ld bytes", size); 00245 00246 00247 #ifdef ENABLE_MEM_CHECK 00248 size -= SIZEOF_LONG; 00249 00250 t = p; 00251 p = ((guchar*) p + SIZEOF_LONG); 00252 *t = 0; 00253 #endif /* ENABLE_MEM_CHECK */ 00254 00255 #if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK) 00256 size -= SIZEOF_LONG; 00257 00258 t = p; 00259 p = ((guchar*) p + SIZEOF_LONG); 00260 *t = size; 00261 00262 # ifdef ENABLE_MEM_PROFILE 00263 g_mutex_lock (mem_profile_lock); 00264 # ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS 00265 if(!IS_IN_MEM_CHUNK_ROUTINE()) { 00266 # endif 00267 if (size <= (MEM_PROFILE_TABLE_SIZE - 1)) 00268 allocations[size-1] += 1; 00269 else 00270 allocations[MEM_PROFILE_TABLE_SIZE - 1] += 1; 00271 allocated_mem += size; 00272 # ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS 00273 } 00274 # endif 00275 g_mutex_unlock (mem_profile_lock); 00276 # endif /* ENABLE_MEM_PROFILE */ 00277 #endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */ 00278 00279 00280 return p; 00281 }
|
|
|
Definition at line 451 of file gmem.c. References g_warning(). 00452 { 00453 #ifdef ENABLE_MEM_CHECK 00454 gulong *t; 00455 00456 t = (gulong*) ((guchar*) mem - SIZEOF_LONG - SIZEOF_LONG); 00457 00458 if (*t >= 1) 00459 g_warning ("mem: 0x%08lx has been freed %lu times\n", (gulong) mem, *t); 00460 #endif /* ENABLE_MEM_CHECK */ 00461 }
|
|
|
Definition at line 555 of file gmem.c. References _GMemArea::allocated, _GRealMemChunk::area_size, _GRealMemChunk::atom_size, ENTER_MEM_CHUNK_ROUTINE, _GMemArea::free, _GRealMemChunk::free_atoms, _GRealMemChunk::free_mem_area, G_ALLOC_AND_FREE, g_free(), g_malloc(), g_mem_chunk_area_search(), g_return_val_if_fail, g_tree_insert(), g_tree_remove(), g_tree_search(), _GMemArea::index, LEAVE_MEM_CHUNK_ROUTINE, _GMemArea::mark, _GMemArea::mem, _GRealMemChunk::mem_area, MEM_AREA_SIZE, _GRealMemChunk::mem_areas, _GRealMemChunk::mem_tree, _GMemArea::next, _GFreeAtom::next, NULL, _GRealMemChunk::num_marked_areas, _GRealMemChunk::num_mem_areas, _GMemArea::prev, and _GRealMemChunk::type. Referenced by g_mem_chunk_alloc0(). 00556 { 00557 GRealMemChunk *rmem_chunk; 00558 GMemArea *temp_area; 00559 gpointer mem; 00560 00561 ENTER_MEM_CHUNK_ROUTINE(); 00562 00563 g_return_val_if_fail (mem_chunk != NULL, NULL); 00564 00565 rmem_chunk = (GRealMemChunk*) mem_chunk; 00566 00567 while (rmem_chunk->free_atoms) 00568 { 00569 /* Get the first piece of memory on the "free_atoms" list. 00570 * We can go ahead and destroy the list node we used to keep 00571 * track of it with and to update the "free_atoms" list to 00572 * point to its next element. 00573 */ 00574 mem = rmem_chunk->free_atoms; 00575 rmem_chunk->free_atoms = rmem_chunk->free_atoms->next; 00576 00577 /* Determine which area this piece of memory is allocated from */ 00578 temp_area = g_tree_search (rmem_chunk->mem_tree, 00579 (GSearchFunc) g_mem_chunk_area_search, 00580 mem); 00581 00582 /* If the area has been marked, then it is being destroyed. 00583 * (ie marked to be destroyed). 00584 * We check to see if all of the segments on the free list that 00585 * reference this area have been removed. This occurs when 00586 * the ammount of free memory is less than the allocatable size. 00587 * If the chunk should be freed, then we place it in the "free_mem_area". 00588 * This is so we make sure not to free the mem area here and then 00589 * allocate it again a few lines down. 00590 * If we don't allocate a chunk a few lines down then the "free_mem_area" 00591 * will be freed. 00592 * If there is already a "free_mem_area" then we'll just free this mem area. 00593 */ 00594 if (temp_area->mark) 00595 { 00596 /* Update the "free" memory available in that area */ 00597 temp_area->free += rmem_chunk->atom_size; 00598 00599 if (temp_area->free == rmem_chunk->area_size) 00600 { 00601 if (temp_area == rmem_chunk->mem_area) 00602 rmem_chunk->mem_area = NULL; 00603 00604 if (rmem_chunk->free_mem_area) 00605 { 00606 rmem_chunk->num_mem_areas -= 1; 00607 00608 if (temp_area->next) 00609 temp_area->next->prev = temp_area->prev; 00610 if (temp_area->prev) 00611 temp_area->prev->next = temp_area->next; 00612 if (temp_area == rmem_chunk->mem_areas) 00613 rmem_chunk->mem_areas = rmem_chunk->mem_areas->next; 00614 00615 if (rmem_chunk->type == G_ALLOC_AND_FREE) 00616 g_tree_remove (rmem_chunk->mem_tree, temp_area); 00617 g_free (temp_area); 00618 } 00619 else 00620 rmem_chunk->free_mem_area = temp_area; 00621 00622 rmem_chunk->num_marked_areas -= 1; 00623 } 00624 } 00625 else 00626 { 00627 /* Update the number of allocated atoms count. 00628 */ 00629 temp_area->allocated += 1; 00630 00631 /* The area wasn't marked...return the memory 00632 */ 00633 goto outa_here; 00634 } 00635 } 00636 00637 /* If there isn't a current mem area or the current mem area is out of space 00638 * then allocate a new mem area. We'll first check and see if we can use 00639 * the "free_mem_area". Otherwise we'll just malloc the mem area. 00640 */ 00641 if ((!rmem_chunk->mem_area) || 00642 ((rmem_chunk->mem_area->index + rmem_chunk->atom_size) > rmem_chunk->area_size)) 00643 { 00644 if (rmem_chunk->free_mem_area) 00645 { 00646 rmem_chunk->mem_area = rmem_chunk->free_mem_area; 00647 rmem_chunk->free_mem_area = NULL; 00648 } 00649 else 00650 { 00651 rmem_chunk->mem_area = (GMemArea*) g_malloc (sizeof (GMemArea) - 00652 MEM_AREA_SIZE + 00653 rmem_chunk->area_size); 00654 00655 rmem_chunk->num_mem_areas += 1; 00656 rmem_chunk->mem_area->next = rmem_chunk->mem_areas; 00657 rmem_chunk->mem_area->prev = NULL; 00658 00659 if (rmem_chunk->mem_areas) 00660 rmem_chunk->mem_areas->prev = rmem_chunk->mem_area; 00661 rmem_chunk->mem_areas = rmem_chunk->mem_area; 00662 00663 if (rmem_chunk->type == G_ALLOC_AND_FREE) 00664 g_tree_insert (rmem_chunk->mem_tree, rmem_chunk->mem_area, rmem_chunk->mem_area); 00665 } 00666 00667 rmem_chunk->mem_area->index = 0; 00668 rmem_chunk->mem_area->free = rmem_chunk->area_size; 00669 rmem_chunk->mem_area->allocated = 0; 00670 rmem_chunk->mem_area->mark = 0; 00671 } 00672 00673 /* Get the memory and modify the state variables appropriately. 00674 */ 00675 mem = (gpointer) &rmem_chunk->mem_area->mem[rmem_chunk->mem_area->index]; 00676 rmem_chunk->mem_area->index += rmem_chunk->atom_size; 00677 rmem_chunk->mem_area->free -= rmem_chunk->atom_size; 00678 rmem_chunk->mem_area->allocated += 1; 00679 00680 outa_here: 00681 00682 LEAVE_MEM_CHUNK_ROUTINE(); 00683 00684 return mem; 00685 }
|
|
|
Definition at line 688 of file gmem.c. References _GRealMemChunk::atom_size, and g_mem_chunk_alloc(). 00689 { 00690 gpointer mem; 00691 00692 mem = g_mem_chunk_alloc (mem_chunk); 00693 if (mem) 00694 { 00695 GRealMemChunk *rmem_chunk = (GRealMemChunk*) mem_chunk; 00696 00697 memset (mem, 0, rmem_chunk->atom_size); 00698 } 00699 00700 return mem; 00701 }
|
|
||||||||||||
|
Definition at line 931 of file gmem.c. References _GMemArea::mem. Referenced by g_mem_chunk_new(), and g_mem_chunk_reset(). 00933 { 00934 if (a->mem > b->mem) 00935 return 1; 00936 else if (a->mem < b->mem) 00937 return -1; 00938 return 0; 00939 }
|
|
||||||||||||
|
Definition at line 942 of file gmem.c. References _GMemArea::index, and _GMemArea::mem. Referenced by g_mem_chunk_alloc(), g_mem_chunk_clean(), and g_mem_chunk_free(). 00944 { 00945 if (a->mem <= addr) 00946 { 00947 if (addr < &a->mem[a->index]) 00948 return 0; 00949 return 1; 00950 } 00951 return -1; 00952 }
|
|
|
Definition at line 746 of file gmem.c. References _GRealMemChunk::area_size, _GRealMemChunk::atom_size, _GMemArea::free, _GRealMemChunk::free_atoms, G_ALLOC_AND_FREE, g_free(), g_mem_chunk_area_search(), g_return_if_fail, g_tree_remove(), g_tree_search(), _GMemArea::mark, _GRealMemChunk::mem_area, _GRealMemChunk::mem_areas, _GRealMemChunk::mem_tree, _GMemArea::next, _GFreeAtom::next, NULL, _GRealMemChunk::num_marked_areas, _GRealMemChunk::num_mem_areas, _GMemArea::prev, and _GRealMemChunk::type. Referenced by g_blow_chunks(). 00747 { 00748 GRealMemChunk *rmem_chunk; 00749 GMemArea *mem_area; 00750 GFreeAtom *prev_free_atom; 00751 GFreeAtom *temp_free_atom; 00752 gpointer mem; 00753 00754 g_return_if_fail (mem_chunk != NULL); 00755 00756 rmem_chunk = (GRealMemChunk*) mem_chunk; 00757 00758 if (rmem_chunk->type == G_ALLOC_AND_FREE) 00759 { 00760 prev_free_atom = NULL; 00761 temp_free_atom = rmem_chunk->free_atoms; 00762 00763 while (temp_free_atom) 00764 { 00765 mem = (gpointer) temp_free_atom; 00766 00767 mem_area = g_tree_search (rmem_chunk->mem_tree, 00768 (GSearchFunc) g_mem_chunk_area_search, 00769 mem); 00770 00771 /* If this mem area is marked for destruction then delete the 00772 * area and list node and decrement the free mem. 00773 */ 00774 if (mem_area->mark) 00775 { 00776 if (prev_free_atom) 00777 prev_free_atom->next = temp_free_atom->next; 00778 else 00779 rmem_chunk->free_atoms = temp_free_atom->next; 00780 temp_free_atom = temp_free_atom->next; 00781 00782 mem_area->free += rmem_chunk->atom_size; 00783 if (mem_area->free == rmem_chunk->area_size) 00784 { 00785 rmem_chunk->num_mem_areas -= 1; 00786 rmem_chunk->num_marked_areas -= 1; 00787 00788 if (mem_area->next) 00789 mem_area->next->prev = mem_area->prev; 00790 if (mem_area->prev) 00791 mem_area->prev->next = mem_area->next; 00792 if (mem_area == rmem_chunk->mem_areas) 00793 rmem_chunk->mem_areas = rmem_chunk->mem_areas->next; 00794 if (mem_area == rmem_chunk->mem_area) 00795 rmem_chunk->mem_area = NULL; 00796 00797 if (rmem_chunk->type == G_ALLOC_AND_FREE) 00798 g_tree_remove (rmem_chunk->mem_tree, mem_area); 00799 g_free (mem_area); 00800 } 00801 } 00802 else 00803 { 00804 prev_free_atom = temp_free_atom; 00805 temp_free_atom = temp_free_atom->next; 00806 } 00807 } 00808 } 00809 }
|
|
||||||||||||
|
Definition at line 911 of file gmem.c. Referenced by g_mem_chunk_new(). 00913 { 00914 gulong power_of_2; 00915 gulong lower, upper; 00916 00917 power_of_2 = 16; 00918 while (power_of_2 < size) 00919 power_of_2 <<= 1; 00920 00921 lower = power_of_2 >> 1; 00922 upper = power_of_2; 00923 00924 if (size - lower < upper - size && lower >= min_size) 00925 return lower; 00926 else 00927 return upper; 00928 }
|
|
|
||||||||||||
|
Definition at line 704 of file gmem.c. References _GMemArea::allocated, ENTER_MEM_CHUNK_ROUTINE, _GRealMemChunk::free_atoms, G_ALLOC_AND_FREE, g_mem_chunk_area_search(), g_return_if_fail, g_tree_search(), LEAVE_MEM_CHUNK_ROUTINE, _GMemArea::mark, _GRealMemChunk::mem_tree, _GFreeAtom::next, NULL, _GRealMemChunk::num_marked_areas, and _GRealMemChunk::type. Referenced by g_array_free(), g_cache_node_destroy(), g_data_set_internal(), g_datalist_clear_i(), g_dataset_destroy_internal(), g_ptr_array_free(), g_relation_exists(), g_string_free(), and main(). 00706 { 00707 GRealMemChunk *rmem_chunk; 00708 GMemArea *temp_area; 00709 GFreeAtom *free_atom; 00710 00711 g_return_if_fail (mem_chunk != NULL); 00712 g_return_if_fail (mem != NULL); 00713 00714 ENTER_MEM_CHUNK_ROUTINE(); 00715 00716 rmem_chunk = (GRealMemChunk*) mem_chunk; 00717 00718 /* Don't do anything if this is an ALLOC_ONLY chunk 00719 */ 00720 if (rmem_chunk->type == G_ALLOC_AND_FREE) 00721 { 00722 /* Place the memory on the "free_atoms" list 00723 */ 00724 free_atom = (GFreeAtom*) mem; 00725 free_atom->next = rmem_chunk->free_atoms; 00726 rmem_chunk->free_atoms = free_atom; 00727 00728 temp_area = g_tree_search (rmem_chunk->mem_tree, 00729 (GSearchFunc) g_mem_chunk_area_search, 00730 mem); 00731 00732 temp_area->allocated -= 1; 00733 00734 if (temp_area->allocated == 0) 00735 { 00736 temp_area->mark = 1; 00737 rmem_chunk->num_marked_areas += 1; 00738 } 00739 } 00740 00741 LEAVE_MEM_CHUNK_ROUTINE(); 00742 }
|
|
|
Definition at line 866 of file gmem.c. References g_log(), g_log_domain_glib, G_LOG_LEVEL_INFO, g_mem_chunk_print(), g_mutex_lock, g_mutex_unlock, mem_chunks_lock, and _GRealMemChunk::next. 00867 { 00868 GRealMemChunk *mem_chunk; 00869 gint count; 00870 00871 count = 0; 00872 g_mutex_lock (mem_chunks_lock); 00873 mem_chunk = mem_chunks; 00874 while (mem_chunk) 00875 { 00876 count += 1; 00877 mem_chunk = mem_chunk->next; 00878 } 00879 g_mutex_unlock (mem_chunks_lock); 00880 00881 g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%d mem chunks", count); 00882 00883 g_mutex_lock (mem_chunks_lock); 00884 mem_chunk = mem_chunks; 00885 g_mutex_unlock (mem_chunks_lock); 00886 00887 while (mem_chunk) 00888 { 00889 g_mem_chunk_print ((GMemChunk*) mem_chunk); 00890 mem_chunk = mem_chunk->next; 00891 } 00892 }
|
|
||||||||||||||||||||
|
|
Definition at line 842 of file gmem.c. References _GRealMemChunk::area_size, _GMemArea::free, g_log(), g_log_domain_glib, G_LOG_LEVEL_INFO, g_return_if_fail, _GRealMemChunk::mem_areas, _GRealMemChunk::name, _GMemArea::next, NULL, and _GRealMemChunk::num_mem_areas. Referenced by g_mem_chunk_info(). 00843 { 00844 GRealMemChunk *rmem_chunk; 00845 GMemArea *mem_areas; 00846 gulong mem; 00847 00848 g_return_if_fail (mem_chunk != NULL); 00849 00850 rmem_chunk = (GRealMemChunk*) mem_chunk; 00851 mem_areas = rmem_chunk->mem_areas; 00852 mem = 0; 00853 00854 while (mem_areas) 00855 { 00856 mem += rmem_chunk->area_size - mem_areas->free; 00857 mem_areas = mem_areas->next; 00858 } 00859 00860 g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, 00861 "%s: %ld bytes using %d mem areas", 00862 rmem_chunk->name, mem, rmem_chunk->num_mem_areas); 00863 }
|
|
|
Definition at line 812 of file gmem.c. References _GRealMemChunk::free_atoms, g_free(), g_mem_chunk_area_compare(), g_return_if_fail, g_tree_destroy(), g_tree_new(), _GRealMemChunk::mem_area, _GRealMemChunk::mem_areas, _GRealMemChunk::mem_tree, _GMemArea::next, NULL, and _GRealMemChunk::num_mem_areas. 00813 { 00814 GRealMemChunk *rmem_chunk; 00815 GMemArea *mem_areas; 00816 GMemArea *temp_area; 00817 00818 g_return_if_fail (mem_chunk != NULL); 00819 00820 rmem_chunk = (GRealMemChunk*) mem_chunk; 00821 00822 mem_areas = rmem_chunk->mem_areas; 00823 rmem_chunk->num_mem_areas = 0; 00824 rmem_chunk->mem_areas = NULL; 00825 rmem_chunk->mem_area = NULL; 00826 00827 while (mem_areas) 00828 { 00829 temp_area = mem_areas; 00830 mem_areas = mem_areas->next; 00831 g_free (temp_area); 00832 } 00833 00834 rmem_chunk->free_atoms = NULL; 00835 00836 if (rmem_chunk->mem_tree) 00837 g_tree_destroy (rmem_chunk->mem_tree); 00838 rmem_chunk->mem_tree = g_tree_new ((GCompareFunc) g_mem_chunk_area_compare); 00839 }
|
|
|
Definition at line 1001 of file gmem.c. References g_mutex_new, g_private_new, mem_chunks_lock, and NULL. Referenced by g_thread_init(). 01002 { 01003 mem_chunks_lock = g_mutex_new(); 01004 #ifdef ENABLE_MEM_PROFILE 01005 mem_profile_lock = g_mutex_new(); 01006 allocating_for_mem_chunk = g_private_new(NULL); 01007 #endif 01008 }
|
|