jmalkin commented on code in PR #325:
URL: https://github.com/apache/datasketches-cpp/pull/325#discussion_r1122238713


##########
count/include/count_min_impl.hpp:
##########
@@ -0,0 +1,322 @@
+#ifndef COUNT_MIN_IMPL_HPP_
+#define COUNT_MIN_IMPL_HPP_
+
+#include "MurmurHash3.h"
+#include <random>
+
+namespace datasketches {
+
+template<typename W>
+count_min_sketch<W>::count_min_sketch(uint8_t num_hashes, uint32_t 
num_buckets, uint64_t seed):
+_num_hashes(num_hashes),
+_num_buckets(num_buckets),
+_sketch_array(num_hashes * num_buckets, 0),

Review Comment:
   This will attempt to initialize a gigantic array, only to later decide that 
it's too big and throw an exception. We can instead do an initial check here:
   `_sketch_array((num_hashes*num_buckets < 1<<30) ? num_hashes*num_buckets : 
0, 0),`
   which should let us re-enabld the unit test check and also avoid a potential 
overallocaiton issue for end-users.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to