Archived
This forum has been archived. Please start a new discussion on GitHub.
Ice::MemoryLimitException
xdm
La Coruña, Spain
in Help Center
Hellow i trying to develop a simple file transfer util.
i define the next slice types
then i write a FileLoader class with the next upload method
This method works fine with small files. When i used this method whit a file of 6 Mb the next thing ocurrs
the method runs ok but in the next ivocation of any method i received the next exception error
I store my Files in server using a Freeze::evictor
can any body sayme what's the troubel in my program?
Tanks in advantage
i define the next slice types
sequence<byte> Bytes;
sequence<long> ChunkRefs;
struct Chunk
{
long id;
Bytes content;
};
dictionary<long,Chunk> ChunksMap;
interface FileReader
{
nonmutating ChunksMap read();
nonmutating ChunkRefs getChunkRefs();
nonmutating Chunk readChunk(long id);
nonmutating int getChunkSize();
};
interface FileWriter
{
idempotent bool write(File source);
idempotent bool addChunk(Chunk source);
}
class File extends Node implements FileReader,FileWriter
{
int chunkSize;
ChunksMap content;
};
then i write a FileLoader class with the next upload method
bool FileLoader::upload(const string& filePath)
{
bool retval;
if(QFile::exists(filePath))
{
ifstream source(filePath.c_str(),ios::binary);
if(source)
{
long chunk_id=0;
cout<<"Chunk size is: "<<target->getChunkSize()<<endl;
while(!source.eof())
{
/*Creating a new chunk for add in to the file*/
Chunk chunk;
chunk.id=chunk_id;
chunk_id++;
chunk.content.resize(target->getChunkSize());
source.read(reinterpret_cast<char*>(&chunk.content[0]),chunk.content.size());
/*
upload the new chunk to target File
*/
target->addChunk(chunk);
}
cout<<"source file upload ok"<<endl;
}
source.close();
retval=true;
}
else
cout<<"File: "<<filePath<<" no Exist"<<endl;
return retval;
}
This method works fine with small files. When i used this method whit a file of 6 Mb the next thing ocurrs
the method runs ok but in the next ivocation of any method i received the next exception error
File: error: Saving thread killed by exception: ../../include/Ice/BasicStream.h:55: Ice::MemoryLimitException: protocol error: memory limit exceeded
I store my Files in server using a Freeze::evictor
can any body sayme what's the troubel in my program?
Tanks in advantage
0
Comments
-
Try setting the property Ice.MessageSizeMax to a higher value. The default is 1024, meaning 1024 KB = 1MB.0
-
thanks mark
thanks mark i set Ice.MessageSizeMax=10240 and now i can upload large files ok
0