maxgreat / sofia-ml

Automatically exported from code.google.com/p/sofia-ml
0 stars 0 forks source link

malloc error with --hash_mask_bits #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Download & build, run the demo commands adding --hash_mask_bits to the 
arguments.  Training proceeds fine, but testing of the model gives the malloc 
error:

$ ./sofia-ml --learner_type pegasos --loop_type stochastic --lambda 0.1 
--iterations 100000 --dimensionality 150000 --training_file demo/demo.train 
--model_out demo/model --hash_mask_bits 8
hash_mask_ 255
Reading training data from: demo/demo.train
Time to read training data: 0.061278
Time to complete training: 52.3639
Writing model to: demo/model
   Done.

$ ./sofia-ml --model_in demo/model --test_file demo/demo.train --results_file 
demo/results.txt --hash_mask_bits 8
hash_mask_ 255
sofia-ml(6235) malloc: *** error for object 0x800000: pointer being freed was 
not allocated
*** set a breakpoint in malloc_error_break to debug
Reading model from: demo/model
   Done.
Reading test data from: demo/demo.train
Time to read test data: 0.06114
Time to make test prediction results: 0.008274
Writing test results to: demo/results.txt
   Done.

========

$ g++ --version
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5659)

Original issue reported on code.google.com by jel...@gmail.com on 18 Jun 2010 at 6:43

GoogleCodeExporter commented 8 years ago
I hit this as well.  I guess the hash_mask_bits code in general isn't so highly 
treaded, I found two bugs in the code, which I fixed.

There is a double delete crash in the SfHashWeightVector destructor (which 
double deletes _weights, which are logically owned/managed by the parent 
class).  Further, the model loading code throws away type information when 
loading the model.

Patch attached.

rrenaud@kingscourt:~/sofia-ml-read-only/sofia-ml$ patch -p0 < 
load_hash_model.patch 
patching file src/sofia-ml.cc
patching file src/sf-hash-weight-vector.cc

Original comment by rrenaud@gmail.com on 2 Aug 2011 at 7:39

Attachments: