ColinLeeo commented on code in PR #110:
URL: https://github.com/apache/tsfile/pull/110#discussion_r1641854290


##########
cpp/src/writer/page_writer.h:
##########
@@ -134,6 +134,18 @@ class PageWriter {
     FORCE_INLINE uint32_t get_page_memory_size() const {
         return time_out_stream_.total_size() + value_out_stream_.total_size();
     }
+    /**
+     * calculate max possible memory size it occupies, including time
+     * outputStream and value outputStream, because size outputStream is never
+     * used until flushing.
+     *
+     * @return allocated size in time, value and outputStream
+     */
+    FORCE_INLINE uint32_t estimate_max_mem_size() const {

Review Comment:
   TsFile 超过4GB 之后返回值可能会泄露?



##########
cpp/src/writer/tsfile_writer.cc:
##########
@@ -242,6 +241,44 @@ int TsFileWriter::do_check_schema(const std::string 
&device_name,
     return ret;
 }
 
+int64_t TsFileWriter::calculate_mem_size_for_all_group() {
+    int64_t mem_total_size = 0;
+    DeviceSchemaIter device_iter;
+    for (device_iter = schemas_.begin(); device_iter != schemas_.end();
+         device_iter++) {
+        MeasurementSchemaGroup *chunk_group = device_iter->second;
+        MeasurementSchemaMap &map = chunk_group->measurement_schema_map_;
+        for (MeasurementSchemaMapIter ms_iter = map.begin();
+             ms_iter != map.end(); ms_iter++) {
+            MeasurementSchema *m_schema = ms_iter->second;
+            ChunkWriter *&chunk_writer = m_schema->chunk_writer_;
+            mem_total_size += chunk_writer->estimate_max_series_mem_size();
+        }

Review Comment:
   这里现在应该还是lazy 初始化的,如果注册了序列,未写入,chunk_writer 就是null



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to