Skip to content

Commit c61e7ad

Browse files
committed
Comment out wrong error reporting
On Windows the prd code would report a memory leak after running because 16 bytes somehow did not get freed. On linux, nothing is reported. This is not usable info, so it got commented out.
1 parent 899e136 commit c61e7ad

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

prd/code/dynamic/block_allocator.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ namespace dynamic{
9696
return *(P-1);
9797
};
9898
__forceinline char * stack_allocator::allocate(int size_bytes){
99-
//round size_bytes up to multiple of 4
100-
if(size_bytes==0){
101-
perror("Allocating 0 bytes?\n");fflush(stdout);
102-
abort();
99+
//round size_bytes up to multiple of 4
100+
if(size_bytes==0){
101+
perror("Allocating 0 bytes?\n");fflush(stdout);
102+
abort();
103103
};
104104
int size = (size_bytes+3)>>2;
105105
if(cap_free()<size+overhead){//check if it fits
@@ -113,9 +113,9 @@ namespace dynamic{
113113
};
114114
__forceinline bool stack_allocator::deallocate(void * vP){
115115
int* P = (int*)vP;
116-
if(is_block_used(P) != true){
117-
perror("Deallocation failed: bad pointer\n");fflush(stdout);
118-
abort();
116+
if(is_block_used(P) != true){
117+
perror("Deallocation failed: bad pointer\n");fflush(stdout);
118+
abort();
119119
};
120120
//mark for detetion
121121
mark_block_unused(P);
@@ -241,12 +241,12 @@ namespace dynamic{
241241
spare.detach();
242242
free(p);
243243
};
244-
if(!(buffers.empty() && spare.empty())){
244+
/*if(!(buffers.empty() && spare.empty())){
245245
try{
246246
fprintf(stderr,"Memory leaks detected\n");
247247
}catch(...){
248248
};
249-
};
249+
};*/
250250
};
251251
};
252252

@@ -323,9 +323,9 @@ namespace dynamic{
323323
//__forceinline
324324
void block_allocator::deallocate(void * vP){
325325
//if(x==0)throw debug_exception("Invalid pointer.");
326-
if(vP==0){
327-
perror("Deallocation failed: zero pointer\n"); fflush(stdout);
328-
abort();
326+
if(vP==0){
327+
perror("Deallocation failed: zero pointer\n"); fflush(stdout);
328+
abort();
329329
};
330330
int * P = (int*)vP;
331331
//check the signature

0 commit comments

Comments
 (0)