By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 2116
Collapse All | Expand All

(-)tdelibs/kjs/collector.cpp (-1 / +6 lines)
Lines 24-29 Link Here
24
#include "value.h"
24
#include "value.h"
25
#include "internal.h"
25
#include "internal.h"
26
#include <limits.h>
26
#include <limits.h>
27
#include <typeinfo>
27
28
28
#ifndef MAX
29
#ifndef MAX
29
#define MAX(a,b) ((a) > (b) ? (a) : (b))
30
#define MAX(a,b) ((a) > (b) ? (a) : (b))
Lines 121-127 void* Collector::allocate(size_t s) Link Here
121
122
122
    if (heap.usedBlocks == heap.numBlocks) {
123
    if (heap.usedBlocks == heap.numBlocks) {
123
      static const size_t maxNumBlocks = ULONG_MAX / sizeof(CollectorBlock*) / GROWTH_FACTOR;
124
      static const size_t maxNumBlocks = ULONG_MAX / sizeof(CollectorBlock*) / GROWTH_FACTOR;
124
      if (heap.numBlocks > maxNumBlocks)
125
      if ((size_t)heap.numBlocks > maxNumBlocks)
125
          return 0L;
126
          return 0L;
126
      heap.numBlocks = MAX(MIN_ARRAY_SIZE, heap.numBlocks * GROWTH_FACTOR);
127
      heap.numBlocks = MAX(MIN_ARRAY_SIZE, heap.numBlocks * GROWTH_FACTOR);
127
      heap.blocks = (CollectorBlock **)realloc(heap.blocks, heap.numBlocks * sizeof(CollectorBlock *));
128
      heap.blocks = (CollectorBlock **)realloc(heap.blocks, heap.numBlocks * sizeof(CollectorBlock *));
Lines 222-227 bool Collector::collect() Link Here
222
      if (!(imp->_flags & ValueImp::VI_DESTRUCTED)) {
223
      if (!(imp->_flags & ValueImp::VI_DESTRUCTED)) {
223
	if (!imp->refcount && imp->_flags == (ValueImp::VI_GCALLOWED | ValueImp::VI_CREATED)) {
224
	if (!imp->refcount && imp->_flags == (ValueImp::VI_GCALLOWED | ValueImp::VI_CREATED)) {
224
	  //fprintf( stderr, "[kjs-collector] Collector::deleting ValueImp %p (%s)\n", (void*)imp, typeid(*imp).name());
225
	  //fprintf( stderr, "[kjs-collector] Collector::deleting ValueImp %p (%s)\n", (void*)imp, typeid(*imp).name());
226
227
	  // prevent double free
228
	  imp->_flags |= ValueImp::VI_DESTRUCTED;
229
225
	  // emulate destructing part of 'operator delete()'
230
	  // emulate destructing part of 'operator delete()'
226
	  imp->~ValueImp();
231
	  imp->~ValueImp();
227
	  curBlock->usedCells--;
232
	  curBlock->usedCells--;

Return to bug 2116