From 620f2541fde640bf51ce6e78ce3190e01797c2b7 Mon Sep 17 00:00:00 2001 From: beru Date: Sat, 10 Aug 2019 23:35:10 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=E8=A1=8C=E3=83=87=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=81=AE=E3=83=A1=E3=83=A2=E3=83=AA=E7=A2=BA=E4=BF=9D=E3=81=AB?= =?UTF-8?q?=E3=83=A1=E3=83=A2=E3=83=AA=E3=83=97=E3=83=BC=E3=83=AB=E4=BD=BF?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/doc/logic/CDocLineMgr.cpp | 14 ++++++++++---- sakura_core/doc/logic/CDocLineMgr.h | 5 ++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sakura_core/doc/logic/CDocLineMgr.cpp b/sakura_core/doc/logic/CDocLineMgr.cpp index 0b5db9a200..5d45c257a7 100644 --- a/sakura_core/doc/logic/CDocLineMgr.cpp +++ b/sakura_core/doc/logic/CDocLineMgr.cpp @@ -52,6 +52,8 @@ // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // CDocLineMgr::CDocLineMgr() + : + m_docLineAllocator(&m_docLinePool) { _Init(); } @@ -68,7 +70,8 @@ CDocLineMgr::~CDocLineMgr() //! pPosの直前に新しい行を挿入 CDocLine* CDocLineMgr::InsertNewLine(CDocLine* pPos) { - CDocLine* pcDocLineNew = new CDocLine; + CDocLine* pcDocLineNew = m_docLineAllocator.allocate(1); + m_docLineAllocator.construct(pcDocLineNew); _InsertBeforePos(pcDocLineNew,pPos); return pcDocLineNew; } @@ -76,7 +79,8 @@ CDocLine* CDocLineMgr::InsertNewLine(CDocLine* pPos) //! 最下部に新しい行を挿入 CDocLine* CDocLineMgr::AddNewLine() { - CDocLine* pcDocLineNew = new CDocLine; + CDocLine* pcDocLineNew = m_docLineAllocator.allocate(1); + m_docLineAllocator.construct(pcDocLineNew); _PushBottom(pcDocLineNew); return pcDocLineNew; } @@ -87,7 +91,8 @@ void CDocLineMgr::DeleteAllLine() CDocLine* pDocLine = m_pDocLineTop; while( pDocLine ){ CDocLine* pDocLineNext = pDocLine->GetNextLine(); - delete pDocLine; + pDocLine->~CDocLine(); + m_docLineAllocator.deallocate(pDocLine, 1); pDocLine = pDocLineNext; } _Init(); @@ -118,7 +123,8 @@ void CDocLineMgr::DeleteLine( CDocLine* pcDocLineDel ) } //データ削除 - delete pcDocLineDel; + pcDocLineDel->~CDocLine(); + m_docLineAllocator.deallocate(pcDocLineDel, 1); //行数減算 m_nLines--; diff --git a/sakura_core/doc/logic/CDocLineMgr.h b/sakura_core/doc/logic/CDocLineMgr.h index 1f9622a198..e9cdf4602b 100644 --- a/sakura_core/doc/logic/CDocLineMgr.h +++ b/sakura_core/doc/logic/CDocLineMgr.h @@ -21,12 +21,13 @@ #define _CDOCLINEMGR_H_ #include +#include #include "_main/global.h" // 2002/2/10 aroka #include "basis/SakuraBasis.h" #include "util/design_template.h" #include "COpe.h" +#include "CDocLine.h" -class CDocLine; // 2002/2/10 aroka class CBregexp; // 2002/2/10 aroka struct DocLineReplaceArg { @@ -89,6 +90,8 @@ class CDocLineMgr{ CDocLine* m_pDocLineTop; //!< 最初の行 CDocLine* m_pDocLineBot; //!< 最後の行(※1行しかない場合はm_pDocLineTopと等しくなる) CLogicInt m_nLines; //!< 全行数 + std::pmr::unsynchronized_pool_resource m_docLinePool; + std::pmr::polymorphic_allocator m_docLineAllocator; public: //$$ kobake注: 以下、絶対に切り離したい(最低切り離せなくても、変数の意味をコメントで明確に記すべき)変数群 From a58e32388ae5676c51c23824e6ad9171f02280bc Mon Sep 17 00:00:00 2001 From: beru Date: Sun, 11 Aug 2019 00:10:05 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E6=83=85=E5=A0=B1=E3=81=AE=E3=83=A1=E3=83=A2=E3=83=AA?= =?UTF-8?q?=E7=A2=BA=E4=BF=9D=E3=81=AB=E3=83=A1=E3=83=A2=E3=83=AA=E3=83=97?= =?UTF-8?q?=E3=83=BC=E3=83=AB=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/doc/layout/CLayoutMgr.cpp | 12 ++++++++---- sakura_core/doc/layout/CLayoutMgr.h | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sakura_core/doc/layout/CLayoutMgr.cpp b/sakura_core/doc/layout/CLayoutMgr.cpp index bb792180a2..0da3e61b83 100644 --- a/sakura_core/doc/layout/CLayoutMgr.cpp +++ b/sakura_core/doc/layout/CLayoutMgr.cpp @@ -36,7 +36,8 @@ // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // CLayoutMgr::CLayoutMgr() -: m_getIndentOffset( &CLayoutMgr::getIndentOffset_Normal ) // Oct. 1, 2002 genta // Nov. 16, 2002 メンバー関数ポインタにはクラス名が必要 +: m_getIndentOffset( &CLayoutMgr::getIndentOffset_Normal ), // Oct. 1, 2002 genta // Nov. 16, 2002 メンバー関数ポインタにはクラス名が必要 + m_layoutAllocator( &m_layoutPool ) { m_pcDocLineMgr = NULL; m_pTypeConfig = NULL; @@ -95,7 +96,8 @@ void CLayoutMgr::_Empty() CLayout* pLayout = m_pLayoutTop; while( pLayout ){ CLayout* pLayoutNext = pLayout->GetNextLayout(); - delete pLayout; + pLayout->~CLayout(); + m_layoutAllocator.deallocate(pLayout, 1); pLayout = pLayoutNext; } } @@ -381,7 +383,8 @@ CLayout* CLayoutMgr::CreateLayout( CLayoutColorInfo* colorInfo ) { - CLayout* pLayout = new CLayout( + CLayout* pLayout = m_layoutAllocator.allocate(1); + m_layoutAllocator.construct(pLayout, pCDocLine, ptLogicPos, nLength, @@ -589,7 +592,8 @@ CLayout* CLayoutMgr::DeleteLayoutAsLogical( DEBUG_TRACE( _T("バグバグ\n") ); } - delete pLayout; + pLayout->~CLayout(); + m_layoutAllocator.deallocate(pLayout, 1); m_nLines--; /* 全物理行数 */ if( NULL == pLayoutNext ){ diff --git a/sakura_core/doc/layout/CLayoutMgr.h b/sakura_core/doc/layout/CLayoutMgr.h index cfc03ad079..51a1efb4dd 100644 --- a/sakura_core/doc/layout/CLayoutMgr.h +++ b/sakura_core/doc/layout/CLayoutMgr.h @@ -24,6 +24,7 @@ #include // 2002/2/10 aroka #include +#include #include "doc/CDocListener.h" #include "_main/global.h"// 2002/2/10 aroka #include "basis/SakuraBasis.h" @@ -37,7 +38,6 @@ #include "util/design_template.h" class CBregexp;// 2002/2/10 aroka -class CLayout;// 2002/2/10 aroka class CDocLineMgr;// 2002/2/10 aroka class CDocLine;// 2002/2/10 aroka class CMemory;// 2002/2/10 aroka @@ -399,6 +399,8 @@ class CLayoutMgr : public CProgressSubject //実データ CLayout* m_pLayoutTop; CLayout* m_pLayoutBot; + std::pmr::unsynchronized_pool_resource m_layoutPool; + std::pmr::polymorphic_allocator m_layoutAllocator; //タイプ別設定 const STypeConfig* m_pTypeConfig; From adb264e8232ea4e444561dc37e904583fda26e24 Mon Sep 17 00:00:00 2001 From: beru Date: Sun, 11 Aug 2019 02:32:22 +0900 Subject: [PATCH 3/7] =?UTF-8?q?std::pmr::polymorphic=5Fallocator=20?= =?UTF-8?q?=E3=81=AF=E4=BD=BF=E3=82=8F=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4=20std::pmr::unsynchronized=5Fpool?= =?UTF-8?q?=5Fresource=20=E3=81=A0=E3=81=A8=E3=83=A1=E3=83=A2=E3=83=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=87=8F=E3=81=8C=E5=A4=A7=E3=81=8D=E3=81=84?= =?UTF-8?q?=E7=82=BA=E3=80=81=E8=87=AA=E5=89=8D=E5=AE=9F=E8=A3=85=E3=82=92?= =?UTF-8?q?=E7=94=A8=E6=84=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/doc/layout/CLayoutMgr.cpp | 11 ++- sakura_core/doc/layout/CLayoutMgr.h | 3 +- sakura_core/doc/logic/CDocLineMgr.cpp | 15 +-- sakura_core/doc/logic/CDocLineMgr.h | 3 +- sakura_core/mem/CPoolResource.h | 136 ++++++++++++++++++++++++++ 5 files changed, 152 insertions(+), 16 deletions(-) create mode 100644 sakura_core/mem/CPoolResource.h diff --git a/sakura_core/doc/layout/CLayoutMgr.cpp b/sakura_core/doc/layout/CLayoutMgr.cpp index 0da3e61b83..d75d8fe55e 100644 --- a/sakura_core/doc/layout/CLayoutMgr.cpp +++ b/sakura_core/doc/layout/CLayoutMgr.cpp @@ -25,6 +25,7 @@ #include "charset/charcode.h" #include "mem/CMemory.h"/// 2002/2/10 aroka #include "mem/CMemoryIterator.h" // 2006.07.29 genta +#include "mem/CPoolResource.h" #include "view/CViewFont.h" #include "view/CTextMetrics.h" #include "basis/SakuraBasis.h" @@ -37,7 +38,8 @@ CLayoutMgr::CLayoutMgr() : m_getIndentOffset( &CLayoutMgr::getIndentOffset_Normal ), // Oct. 1, 2002 genta // Nov. 16, 2002 メンバー関数ポインタにはクラス名が必要 - m_layoutAllocator( &m_layoutPool ) + m_layoutMemRes(new CPoolResource()) + //m_layoutMemRes(new std::pmr::unsynchronized_pool_resource()) // メモリ使用量が大きい為に使用しないで、CPoolResource を代わりに使う { m_pcDocLineMgr = NULL; m_pTypeConfig = NULL; @@ -97,7 +99,7 @@ void CLayoutMgr::_Empty() while( pLayout ){ CLayout* pLayoutNext = pLayout->GetNextLayout(); pLayout->~CLayout(); - m_layoutAllocator.deallocate(pLayout, 1); + m_layoutMemRes->deallocate(pLayout, sizeof(CLayout), alignof(CLayout)); pLayout = pLayoutNext; } } @@ -383,8 +385,7 @@ CLayout* CLayoutMgr::CreateLayout( CLayoutColorInfo* colorInfo ) { - CLayout* pLayout = m_layoutAllocator.allocate(1); - m_layoutAllocator.construct(pLayout, + CLayout* pLayout = new (m_layoutMemRes->allocate(sizeof(CLayout))) CLayout( pCDocLine, ptLogicPos, nLength, @@ -593,7 +594,7 @@ CLayout* CLayoutMgr::DeleteLayoutAsLogical( } pLayout->~CLayout(); - m_layoutAllocator.deallocate(pLayout, 1); + m_layoutMemRes->deallocate(pLayout, sizeof(CLayout), alignof(CLayout)); m_nLines--; /* 全物理行数 */ if( NULL == pLayoutNext ){ diff --git a/sakura_core/doc/layout/CLayoutMgr.h b/sakura_core/doc/layout/CLayoutMgr.h index 51a1efb4dd..d0f74f81a4 100644 --- a/sakura_core/doc/layout/CLayoutMgr.h +++ b/sakura_core/doc/layout/CLayoutMgr.h @@ -399,8 +399,7 @@ class CLayoutMgr : public CProgressSubject //実データ CLayout* m_pLayoutTop; CLayout* m_pLayoutBot; - std::pmr::unsynchronized_pool_resource m_layoutPool; - std::pmr::polymorphic_allocator m_layoutAllocator; + std::unique_ptr m_layoutMemRes; //タイプ別設定 const STypeConfig* m_pTypeConfig; diff --git a/sakura_core/doc/logic/CDocLineMgr.cpp b/sakura_core/doc/logic/CDocLineMgr.cpp index 5d45c257a7..620e239f14 100644 --- a/sakura_core/doc/logic/CDocLineMgr.cpp +++ b/sakura_core/doc/logic/CDocLineMgr.cpp @@ -38,6 +38,7 @@ // May 15, 2000 genta #include "CEol.h" #include "mem/CMemory.h"// 2002/2/10 aroka +#include "mem/CPoolResource.h" #include "io/CFileLoad.h" // 2002/08/30 Moca #include "io/CIoBridge.h" @@ -53,7 +54,9 @@ CDocLineMgr::CDocLineMgr() : - m_docLineAllocator(&m_docLinePool) + m_docLineMemRes(new CPoolResource()) + //m_docLineMemRes(new std::pmr::unsynchronized_pool_resource()) // メモリ使用量が大きい為に使用しないで、CPoolResource を代わりに使う + { _Init(); } @@ -70,8 +73,7 @@ CDocLineMgr::~CDocLineMgr() //! pPosの直前に新しい行を挿入 CDocLine* CDocLineMgr::InsertNewLine(CDocLine* pPos) { - CDocLine* pcDocLineNew = m_docLineAllocator.allocate(1); - m_docLineAllocator.construct(pcDocLineNew); + CDocLine* pcDocLineNew = new (m_docLineMemRes->allocate(sizeof(CDocLine))) CDocLine(); _InsertBeforePos(pcDocLineNew,pPos); return pcDocLineNew; } @@ -79,8 +81,7 @@ CDocLine* CDocLineMgr::InsertNewLine(CDocLine* pPos) //! 最下部に新しい行を挿入 CDocLine* CDocLineMgr::AddNewLine() { - CDocLine* pcDocLineNew = m_docLineAllocator.allocate(1); - m_docLineAllocator.construct(pcDocLineNew); + CDocLine* pcDocLineNew = new (m_docLineMemRes->allocate(sizeof(CDocLine))) CDocLine(); _PushBottom(pcDocLineNew); return pcDocLineNew; } @@ -92,7 +93,7 @@ void CDocLineMgr::DeleteAllLine() while( pDocLine ){ CDocLine* pDocLineNext = pDocLine->GetNextLine(); pDocLine->~CDocLine(); - m_docLineAllocator.deallocate(pDocLine, 1); + m_docLineMemRes->deallocate(pDocLine, sizeof(CDocLine)); pDocLine = pDocLineNext; } _Init(); @@ -124,7 +125,7 @@ void CDocLineMgr::DeleteLine( CDocLine* pcDocLineDel ) //データ削除 pcDocLineDel->~CDocLine(); - m_docLineAllocator.deallocate(pcDocLineDel, 1); + m_docLineMemRes->deallocate(pcDocLineDel, sizeof(CDocLine)); //行数減算 m_nLines--; diff --git a/sakura_core/doc/logic/CDocLineMgr.h b/sakura_core/doc/logic/CDocLineMgr.h index e9cdf4602b..819dce8ef5 100644 --- a/sakura_core/doc/logic/CDocLineMgr.h +++ b/sakura_core/doc/logic/CDocLineMgr.h @@ -90,8 +90,7 @@ class CDocLineMgr{ CDocLine* m_pDocLineTop; //!< 最初の行 CDocLine* m_pDocLineBot; //!< 最後の行(※1行しかない場合はm_pDocLineTopと等しくなる) CLogicInt m_nLines; //!< 全行数 - std::pmr::unsynchronized_pool_resource m_docLinePool; - std::pmr::polymorphic_allocator m_docLineAllocator; + std::unique_ptr m_docLineMemRes; public: //$$ kobake注: 以下、絶対に切り離したい(最低切り離せなくても、変数の意味をコメントで明確に記すべき)変数群 diff --git a/sakura_core/mem/CPoolResource.h b/sakura_core/mem/CPoolResource.h new file mode 100644 index 0000000000..ddd00588cb --- /dev/null +++ b/sakura_core/mem/CPoolResource.h @@ -0,0 +1,136 @@ +/* + Copyright (C) 2018-2019 Sakura Editor Organization + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; + you must not claim that you wrote the original software. + If you use this software in a product, an acknowledgment + in the product documentation would be appreciated but is + not required. + + 2. Altered source versions must be plainly marked as such, + and must not be misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. +*/ + +#ifndef SAKURA_CPOOLRESOURCE_H_ +#define SAKURA_CPOOLRESOURCE_H_ + +#include +#include + +// std::pmr::unsynchronized_pool_resource だとメモリ使用量が大きい為、自前実装を用意 +// T : 要素型 +template +class CPoolResource : public std::pmr::memory_resource +{ +public: + CPoolResource() + { + // 始めのブロックをメモリ確保 + AllocateBlock(); + } + + virtual ~CPoolResource() + { + // メモリ確保した領域の連結リストを辿って全てのブロック分のメモリ解放 + Node* curr = m_currentBlock; + while (curr) { + Node* next = curr->next; + VirtualFree(curr, 0, MEM_RELEASE); + curr = next; + } + } + +protected: + // 要素のメモリ確保処理、要素の領域のポインタを返す + // bytes と alignment 引数は使用しない、template 引数の型で静的に決定する + void* do_allocate([[maybe_unused]] std::size_t bytes, + [[maybe_unused]] std::size_t alignment) override + { + // メモリ確保時には未割当領域から使用していく + if (m_unassignedNode) { + T* ret = reinterpret_cast(m_unassignedNode); + m_unassignedNode = m_unassignedNode->next; + return ret; + } + else { + // 未割当領域が無い場合は、ブロックの中から切り出す + // 現在のブロックに新規確保するNodeサイズ分の領域が余っていない場合は新規のブロックを確保 + Node* blockEnd = reinterpret_cast(reinterpret_cast(m_currentBlock) + BlockSize); + if (m_currentNode + 1 >= blockEnd) { + AllocateBlock(); + } + // 要素の領域のポインタを返すと同時にポインタを次に進めて切り出す位置を更新する + return reinterpret_cast(m_currentNode++); + } + } + + // メモリ解放処理、要素の領域のポインタを受け取る + // 第1引数には、do_allocate メソッドで返したポインタを渡す事 + // bytes と alignment 引数は使用しない、template 引数の型で静的に決定する + void do_deallocate(void* p, + [[maybe_unused]] std::size_t bytes, + [[maybe_unused]] std::size_t alignment) override + { + if (p) { + // メモリ解放した領域を未割当領域として自己参照共用体の片方向連結リストで繋げる + // 次回のメモリ確保時にその領域を再利用する + Node* next = m_unassignedNode; + m_unassignedNode = reinterpret_cast(p); + m_unassignedNode->next = next; + } + } + + bool do_is_equal(const std::pmr::memory_resource& other) const noexcept override + { + return this == &other; + } + +private: + static constexpr size_t BlockSize = 1024 * 64; // VirtualAlloc を使用する為このサイズ + + // 共用体を使う事で要素型と自己参照用のポインタを同じ領域に割り当てる + // 共用体のサイズは各メンバを格納できるサイズになる事を利用する + union Node { + ~Node() {} + T element; // 要素型 + Node* next; // ブロックのヘッダの場合は、次のブロックに繋がる + // 解放後の未割当領域の場合は次の未割当領域に繋がる + }; + + static_assert(2 * sizeof(Node) <= BlockSize, "sizeof(T) too big."); + + // 呼び出しの度にメモリの動的確保を細かく行う事を避ける為に、一括でブロック領域を確保 + // ブロックの先頭(head)にはブロックの連結用のポインタが配置され、残る領域(body)には要素が記録される + void AllocateBlock() + { + char* buff = reinterpret_cast(VirtualAlloc(NULL, BlockSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE)); + Node* next = m_currentBlock; + // ブロック領域の先頭(head)はNodeのポインタとして扱い、以前に作成したブロックに連結する + m_currentBlock = reinterpret_cast(buff); + m_currentBlock->next = next; + + // ブロック領域の残る部分は要素の領域とするが、アライメントを取る + void* body = buff + sizeof(Node*); + size_t space = BlockSize - sizeof(Node*); + body = std::align(alignof(Node), sizeof(Node), body, space); + assert(body); + m_currentNode = reinterpret_cast(body); + } + + Node* m_unassignedNode = nullptr; // 未割当領域の先頭 + Node* m_currentBlock = nullptr; // 現在のブロック + Node* m_currentNode = nullptr; // 要素確保処理時に現在のブロックの中から切り出すNodeを指すポインタ、メモリ確保時に未割当領域が無い場合はここを使う +}; + +#endif /* SAKURA_CPOOLRESOURCE_H_ */ From 6aa9b7d2c67dd0f91615364855f107c610d58411 Mon Sep 17 00:00:00 2001 From: Katsuhisa Yuasa Date: Tue, 13 Aug 2019 20:57:36 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E6=8C=87=E6=91=98=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/doc/layout/CLayoutMgr.cpp | 6 +++--- sakura_core/doc/logic/CDocLineMgr.cpp | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sakura_core/doc/layout/CLayoutMgr.cpp b/sakura_core/doc/layout/CLayoutMgr.cpp index d75d8fe55e..9e58d7b0b4 100644 --- a/sakura_core/doc/layout/CLayoutMgr.cpp +++ b/sakura_core/doc/layout/CLayoutMgr.cpp @@ -37,9 +37,9 @@ // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // CLayoutMgr::CLayoutMgr() -: m_getIndentOffset( &CLayoutMgr::getIndentOffset_Normal ), // Oct. 1, 2002 genta // Nov. 16, 2002 メンバー関数ポインタにはクラス名が必要 - m_layoutMemRes(new CPoolResource()) - //m_layoutMemRes(new std::pmr::unsynchronized_pool_resource()) // メモリ使用量が大きい為に使用しないで、CPoolResource を代わりに使う +: m_getIndentOffset( &CLayoutMgr::getIndentOffset_Normal ) // Oct. 1, 2002 genta // Nov. 16, 2002 メンバー関数ポインタにはクラス名が必要 + , m_layoutMemRes(new CPoolResource()) + //, m_layoutMemRes(new std::pmr::unsynchronized_pool_resource()) // メモリ使用量が大きい為に使用しない { m_pcDocLineMgr = NULL; m_pTypeConfig = NULL; diff --git a/sakura_core/doc/logic/CDocLineMgr.cpp b/sakura_core/doc/logic/CDocLineMgr.cpp index 620e239f14..39aafea884 100644 --- a/sakura_core/doc/logic/CDocLineMgr.cpp +++ b/sakura_core/doc/logic/CDocLineMgr.cpp @@ -53,10 +53,8 @@ // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // CDocLineMgr::CDocLineMgr() - : - m_docLineMemRes(new CPoolResource()) - //m_docLineMemRes(new std::pmr::unsynchronized_pool_resource()) // メモリ使用量が大きい為に使用しないで、CPoolResource を代わりに使う - + : m_docLineMemRes(new CPoolResource()) + //: m_docLineMemRes(new std::pmr::unsynchronized_pool_resource()) // メモリ使用量が大きい為に使用しない { _Init(); } From a97e50e62a69f5ecd9bc058183d5dcf6546f6b34 Mon Sep 17 00:00:00 2001 From: Katsuhisa Yuasa Date: Tue, 13 Aug 2019 23:57:24 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E6=8C=87=E6=91=98=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/mem/CPoolResource.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sakura_core/mem/CPoolResource.h b/sakura_core/mem/CPoolResource.h index ddd00588cb..29fb4a1829 100644 --- a/sakura_core/mem/CPoolResource.h +++ b/sakura_core/mem/CPoolResource.h @@ -115,6 +115,7 @@ class CPoolResource : public std::pmr::memory_resource void AllocateBlock() { char* buff = reinterpret_cast(VirtualAlloc(NULL, BlockSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE)); + if (!buff) throw std::bad_alloc(); Node* next = m_currentBlock; // ブロック領域の先頭(head)はNodeのポインタとして扱い、以前に作成したブロックに連結する m_currentBlock = reinterpret_cast(buff); From b67852b7c743f170d8855aa7e7082b7545b8dc4c Mon Sep 17 00:00:00 2001 From: Katsuhisa Yuasa Date: Wed, 14 Aug 2019 14:45:39 +0900 Subject: [PATCH 6/7] =?UTF-8?q?CLayoutMgr.h=20=E3=81=AB=E3=81=8A=E3=81=84?= =?UTF-8?q?=E3=81=A6=20CLayout=20=E3=81=AE=E5=89=8D=E6=96=B9=E5=AE=A3?= =?UTF-8?q?=E8=A8=80=E3=81=AF=E5=89=8A=E3=82=89=E3=81=AA=E3=81=84=E3=81=A7?= =?UTF-8?q?=E5=85=83=E3=81=AE=E3=81=BE=E3=81=BE=E3=81=AB=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=8A=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/doc/layout/CLayoutMgr.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sakura_core/doc/layout/CLayoutMgr.h b/sakura_core/doc/layout/CLayoutMgr.h index d0f74f81a4..2c9524ef3c 100644 --- a/sakura_core/doc/layout/CLayoutMgr.h +++ b/sakura_core/doc/layout/CLayoutMgr.h @@ -38,6 +38,7 @@ #include "util/design_template.h" class CBregexp;// 2002/2/10 aroka +class CLayout;// 2002/2/10 aroka class CDocLineMgr;// 2002/2/10 aroka class CDocLine;// 2002/2/10 aroka class CMemory;// 2002/2/10 aroka From 91befa49efe182ffbca32eedd8174c1f5bc2c64a Mon Sep 17 00:00:00 2001 From: Katsuhisa Yuasa Date: Thu, 15 Aug 2019 17:13:57 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E6=8C=87=E6=91=98=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura/sakura.vcxproj | 1 + sakura/sakura.vcxproj.filters | 3 +++ 2 files changed, 4 insertions(+) diff --git a/sakura/sakura.vcxproj b/sakura/sakura.vcxproj index 64e3ee05f6..67c3cfcb84 100644 --- a/sakura/sakura.vcxproj +++ b/sakura/sakura.vcxproj @@ -438,6 +438,7 @@ + diff --git a/sakura/sakura.vcxproj.filters b/sakura/sakura.vcxproj.filters index 776fce9f4e..a67d061dcb 100644 --- a/sakura/sakura.vcxproj.filters +++ b/sakura/sakura.vcxproj.filters @@ -1088,6 +1088,9 @@ Cpp Source Files\recent + + Cpp Source Files\mem +