[CONJ-110] Wastage of memory Created: 2014-08-30  Updated: 2016-08-23  Resolved: 2016-08-23

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.1.7
Fix Version/s: 1.5.1-RC

Type: Bug Priority: Major
Reporter: Kavneet Kaur Assignee: Diego Dupin
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

~maria-captains/mariadb-java-client/trunk : /src/test/java/org/mariadb/jdbc/BigQueryTest.java (revision 516) Big Query activated in this, contains a char array of 20000000.



 Comments   
Comment by Kavneet Kaur [ 2014-08-30 ]

This is something that can be modified. All big queries possible cannot occupy this space. This is sort of leading to more of wastage of memory.

The same could be done at a size (50-90)% lesser.

Comment by Vladislav Vaintroub [ 2014-09-13 ]

The test is actually fine , the only thing it needs is better documentation.
The purpose of it is to check how the driver behaves, if the query can't fit into single MySQL packet (must be about 16MB). The point that queries cannot be large is also wrong, mainly due to (default) prepared statement implementation on the client-side . If you send a blob, then large query is generated, and blobs can easily be larger than 16MB.

Comment by Kavneet Kaur [ 2014-09-14 ]

Point is 'if' even when the big query is not being executed, still the code is compiled upon call. Using array data structure leads to reservation and thus wastage. If the data structure used could be dynamic like linked list, it would not only resolve the issue of wastage but would also support queries bigger than the supported one.

Comment by Vladislav Vaintroub [ 2014-09-14 ]

Hmm, dont really get this point. It is Java, i.e arrays , like everything else is allocated on heap. There is no allocation upon compilation . Also, that char array is used to constuct a big String that is passed to executeUpdate(). There is no way to use linked list to construct String , is there?

Comment by Kavneet Kaur [ 2014-09-15 ]

We can create a class to do something like linked list. Java obviously can't implement linked list because of no-pointer concept.

Comment by Massimo Siani (Inactive) [ 2014-11-10 ]

I don't get this one. What's the purpose here? I may be wrong, but any list will use more memory than an array.
Can you be more specific?

Comment by Kavneet Kaur [ 2014-12-19 ]

instead of specifying the size, we can use:
1. dynamic allocation,
2. Collections in Util package
3. RandomAccess Interface
4. MapInterface

this should server a better alternative to the static allocation and reservation.

Comment by Diego Dupin [ 2016-08-23 ]

Test now is checking max_allowed_packet size before using arrays.
so arrays won't be allocated is test wont run.

Current implementation is way faster than other implementations that are using less memory.
Better to have fast unit tests than less memory consumption.

Generated at Thu Feb 08 03:13:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.