mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-08 04:27:53 +03:00
bug in allocating mem
This commit is contained in:
parent
9703339cb8
commit
d1df875191
@ -12,6 +12,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits>
|
||||
#include <iostream>
|
||||
|
||||
class MemPool {
|
||||
struct Page {
|
||||
@ -134,7 +135,10 @@ class ObjectPoolContiguous {
|
||||
|
||||
void push(T &obj) {
|
||||
if (m_size >= m_actualSize) {
|
||||
m_vec = (T*) realloc(m_vec, m_size * 2);
|
||||
//std::cerr << std::endl << "MORE " << m_size << std::endl;
|
||||
m_actualSize *= 2;
|
||||
m_vec = (T*) realloc(m_vec, sizeof(T) * m_actualSize);
|
||||
|
||||
}
|
||||
m_vec[m_size] = obj;
|
||||
++m_size;
|
||||
|
Loading…
Reference in New Issue
Block a user