locked
SqlCeResultSet use too much memory RRS feed

  • Question

  • Hi All,

    Wonder why SqlCeResultSet consume too much memory, I have a table which has 0 record (zero record) however right after the connection open, i saw the memory jump from 55 to 68 mb (around 13 mb was consumed)

    my code look like below:

     

    private SqlCeResultSet StudentResultSet;

    public void InitialStudentSet()

    {

        string query = "SELECT StudentID, Name, Age, Gender FROM Student";

                SqlCeCommand cmd = new SqlCeCommand(query,connection);

                cmd.Connection.Open(); // memory usage increased after this line 

     

                StudentResultSet = cmd.ExecuteResultSet(ResultSetOptions.Updatable | ResultSetOptions.Scrollable);

    }

     

     

    Again, there is 0 record (zero record) in this table.

    Can someone explain why?

     

    Thanks

     

    Sam

    Friday, August 26, 2011 9:41 PM

Answers

  • Hi Paul, I know why now.

    It is the Max Buffer Size in connection string which I set to 8mb, so I reduced this number to 2mb and the connection only occupy 4mb of memory.

    Sam.

    • Marked as answer by EverForest Monday, August 29, 2011 6:05 PM
    Monday, August 29, 2011 6:05 PM

All replies

  • I can't explain it - just don't see how class which is not even created yet can consume anything. Why do you believe it's result set and not, say, connection opening? What's going to happen if you remove result set creation line?

    Also, which memory are you talking about (program memory, storage memory, virtual memory, etc.)?


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Saturday, August 27, 2011 3:41 PM
  • Yes it is weird as I also think that how can it consume too much memory even not created yet. Let me try open other connection. I'm talking the RAM.

     

    Sam.

    Monday, August 29, 2011 3:16 PM
  • Hi Paul, I know why now.

    It is the Max Buffer Size in connection string which I set to 8mb, so I reduced this number to 2mb and the connection only occupy 4mb of memory.

    Sam.

    • Marked as answer by EverForest Monday, August 29, 2011 6:05 PM
    Monday, August 29, 2011 6:05 PM