#include "freelist.h"
#include "danerror.h"
#include "callcpp.h"
#include <memory.h>
Go to the source code of this file.
void mem_tidy | ( | int | level | ) |
Do nothing.
Definition at line 76 of file freelist.cpp.
References c_check_mem().
Referenced by AddNewChunk().
00076 { 00077 c_check_mem ("Old tidy", level); 00078 }
int* memalloc | ( | int | size | ) |
Memory allocator with protection.
Definition at line 37 of file freelist.cpp.
References c_alloc_mem(), and mem_alloc_counter.
Referenced by array_new(), bin_to_chunks(), blobs_widths(), create_matrix(), init_match_table(), init_permdawg(), init_permute(), new_hash_table(), new_search(), new_tally(), record_blob_bounds(), replace_char_widths(), and state_char_widths().
00037 { 00038 mem_alloc_counter++; 00039 return ((int *) c_alloc_mem (size)); 00040 }
int* memalloc_p | ( | int | size | ) |
Memory allocator with protection.
Definition at line 26 of file freelist.cpp.
References c_alloc_mem_p(), DoError(), and mem_alloc_counter.
00026 { 00027 mem_alloc_counter++; 00028 if (!size) 00029 DoError (0, "Allocation of 0 bytes"); 00030 return ((int *) c_alloc_mem_p (size)); 00031 }
void memfree | ( | void * | element | ) |
Memory allocator with protection.
Definition at line 61 of file freelist.cpp.
References c_free_mem(), cprintf(), DoError(), and mem_alloc_counter.
Referenced by classify_piece(), CleanUpUnusedData(), ComputeStatistics(), CreateClusterTree(), delete_search(), destroy_nodes(), end_match_table(), end_metrics(), end_permdawg(), end_permute(), evaluate_state(), free_matrix(), free_outline(), FreeBadChoice(), FreeBitVector(), FreeClass(), FreeClassFields(), FreeCluster(), FreeClusterer(), FreeFeatureSet(), FreeKDNode(), FreeKDTree(), FreePrototype(), FreeStatistics(), FreeSubTree(), FreeTempConfig(), InitChoiceAccum(), LogNewRawChoice(), MakeKDTree(), MultipleCharSamples(), rebuild_current_state(), record_piece_ratings(), save_best_state(), TestEllipticalProto(), and width_priority().
00061 { 00062 if (element) { 00063 c_free_mem(element); 00064 mem_alloc_counter--; 00065 } 00066 else { 00067 cprintf ("%d MEM_ALLOC's used\n", mem_alloc_counter); 00068 DoError (0, "Memfree of NULL pointer"); 00069 } 00070 }
int* memrealloc | ( | void * | ptr, | |
int | size, | |||
int | oldsize | |||
) |
Memory allocator with protection.
Definition at line 46 of file freelist.cpp.
References c_alloc_mem(), and c_free_mem().
Referenced by array_push().
00046 { 00047 int shiftsize; 00048 int *newbuf; 00049 00050 shiftsize = size > oldsize ? oldsize : size; 00051 newbuf = (int *) c_alloc_mem (size); 00052 memcpy(newbuf, ptr, shiftsize); 00053 c_free_mem(ptr); 00054 return newbuf; 00055 }
int mem_alloc_counter = 0 [static] |
** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** http://www.apache.org/licenses/LICENSE-2.0 ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
Definition at line 21 of file freelist.cpp.
Referenced by memalloc(), memalloc_p(), and memfree().