Created
May 2, 2013 14:20
-
-
Save karlnapf/5502520 to your computer and use it in GitHub Desktop.
Minimal program that has problem with streaming features
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <shogun/io/streaming/StreamingAsciiFile.h> | |
#include <shogun/features/streaming/StreamingSparseFeatures.h> | |
using namespace shogun; | |
int main(int argc, char *argv[]) | |
{ | |
init_shogun(); | |
CStreamingAsciiFile *file=new CStreamingAsciiFile("trivial-crash-example.dat"); | |
SG_REF(file); | |
CStreamingSparseFeatures<float64_t> *stream_features= | |
new CStreamingSparseFeatures<float64_t>(file, true, 1024); | |
SG_REF(stream_features); | |
stream_features->start_parser(); | |
while (stream_features->get_next_example()) | |
{ | |
// first try: this one leads to double-free in SG_UNREF(stream) | |
stream_features->get_vector(); | |
stream_features->release_example(); | |
} | |
stream_features->end_parser(); | |
// double free | |
SG_UNREF(stream_features); | |
SG_UNREF(file); | |
exit_shogun(); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 5:-1 | |
1 92:1 | |
0 10:1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment