Home Help Center

Ice::MemoryLimitException

xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
Hellow i trying to develop a simple file transfer util.


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

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Try setting the property Ice.MessageSizeMax to a higher value. The default is 1024, meaning 1024 KB = 1MB.
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    thanks mark

    thanks mark i set Ice.MessageSizeMax=10240 and now i can upload large files ok :D
Sign In or Register to comment.